function addMarkers(){ mySelect = document.getElementById('selection'); Canton = [];Warrenton = [];Atlanta = [];Roswell = [];Smyrna = [];Lithonia = [];Acworth = [];Lawrenceville = [];Martinez = [];Powder_Springs = [];Bellville = [];Douglasville = [];Macon = [];mySelect.options[mySelect.options.length] = new Option("Acworth schools",'all=Acworth'); mySelect.options[mySelect.options.length] = new Option("Atlanta schools",'all=Atlanta'); mySelect.options[mySelect.options.length] = new Option("Bellville schools",'all=Bellville'); mySelect.options[mySelect.options.length] = new Option("Canton schools",'all=Canton'); mySelect.options[mySelect.options.length] = new Option("Douglasville schools",'all=Douglasville'); mySelect.options[mySelect.options.length] = new Option("Lawrenceville schools",'all=Lawrenceville'); mySelect.options[mySelect.options.length] = new Option("Lithonia schools",'all=Lithonia'); mySelect.options[mySelect.options.length] = new Option("Macon schools",'all=Macon'); mySelect.options[mySelect.options.length] = new Option("Martinez schools",'all=Martinez'); mySelect.options[mySelect.options.length] = new Option("Powder Springs schools",'all=Powder_Springs'); mySelect.options[mySelect.options.length] = new Option("Roswell schools",'all=Roswell'); mySelect.options[mySelect.options.length] = new Option("Smyrna schools",'all=Smyrna'); mySelect.options[mySelect.options.length] = new Option("Warrenton schools",'all=Warrenton'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Canton[Canton.length] = createMarker(new GPoint(-84.53511500,34.16088600),"
American Heritage Academy
2126 Sixes Road
Canton, GA 30114
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("American Heritage Academy",'Canton=' + Canton.length); Warrenton[Warrenton.length] = createMarker(new GPoint(-82.57530900,33.42675500),"
Briarwood Academy
4859 Thomson Highway Ne
Warrenton, GA 30828
Co-ed school, 5-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Briarwood Academy",'Warrenton=' + Warrenton.length); Atlanta[Atlanta.length] = createMarker(new GPoint(-84.31398700,33.73621000),"
Clara Mohammed Elementary/w. D
735 Fayetteville Road Se
Atlanta, GA 30316
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Clara Mohammed Elementary/w. D",'Atlanta=' + Atlanta.length); Roswell[Roswell.length] = createMarker(new GPoint(-84.33939600,34.01596200),"
Cottage School (the)
700 Grimes Bridge Road
Roswell, GA 30075
Co-ed school, 6-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Cottage School (the)",'Roswell=' + Roswell.length); Smyrna[Smyrna.length] = createMarker(new GPoint(-84.50773200,33.87696500),"
Covenant Christian School
3130 Atlanta Road Se
Smyrna, GA 30080
Co-ed school, 5-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Covenant Christian School",'Smyrna=' + Smyrna.length); Atlanta[Atlanta.length] = createMarker(new GPoint(-84.42560700,33.75816500),"
The Edelman Center
350 Spelman Lane Sw Box 89
Atlanta, GA 30314
Co-ed school, NS-PK
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The Edelman Center",'Atlanta=' + Atlanta.length); Lithonia[Lithonia.length] = createMarker(new GPoint(-84.12100000,33.73500000),"
Faith Academy
Po Box 610
Lithonia, GA 30058
Co-ed school, PK-9
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Faith Academy",'Lithonia=' + Lithonia.length); Acworth[Acworth.length] = createMarker(new GPoint(-84.59800300,34.08871900),"
Furtah Preparatory School
5496 Highway 92
Acworth, GA 30102
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Furtah Preparatory School",'Acworth=' + Acworth.length); Lawrenceville[Lawrenceville.length] = createMarker(new GPoint(-83.96482200,34.00923700),"
Hope Springs Christian Learning Center
1239 Braselton Highway
Lawrenceville, GA 30043
Co-ed school, 2-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Hope Springs Christian Learning Center",'Lawrenceville=' + Lawrenceville.length); Atlanta[Atlanta.length] = createMarker(new GPoint(-84.32021000,33.83374200),"
Immaculate Heart Of Mary School
2855 Briarcliff Road Ne
Atlanta, GA 30329
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Immaculate Heart Of Mary School",'Atlanta=' + Atlanta.length); Martinez[Martinez.length] = createMarker(new GPoint(-82.09135600,33.52398900),"
Martinez Montessori Academy
3765 Old Petersburg Road
Martinez, GA 30907
Co-ed school, PK-2
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Martinez Montessori Academy",'Martinez=' + Martinez.length); Powder_Springs[Powder_Springs.length] = createMarker(new GPoint(-84.68803000,33.94456400),"
Midway Covenant Christian School
4635 Dallas Highway
Powder Springs, GA 30127
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Midway Covenant Christian School",'Powder_Springs=' + Powder_Springs.length); Bellville[Bellville.length] = createMarker(new GPoint(-81.97440000,32.15220000),"
Pinewood Christian Academy
Po Box 7
Bellville, GA 30414
Co-ed school, 5-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Pinewood Christian Academy",'Bellville=' + Bellville.length); Atlanta[Atlanta.length] = createMarker(new GPoint(-84.39643500,33.88887400),"
The Schenck School, Inc
282 Mt Paran Road Nw
Atlanta, GA 30327
Co-ed school, 1-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The Schenck School, Inc",'Atlanta=' + Atlanta.length); Douglasville[Douglasville.length] = createMarker(new GPoint(-84.72968500,33.74082700),"
Sunbrook Academy At Creekside
6029 Professional Parkway
Douglasville, GA 30134
Co-ed school, NS-PK
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Sunbrook Academy At Creekside",'Douglasville=' + Douglasville.length); Macon[Macon.length] = createMarker(new GPoint(-83.71772900,32.89174100),"
Tattnall Square Academy
111 Trojan Trail
Macon, GA 31210
Co-ed school, 5-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Tattnall Square Academy",'Macon=' + Macon.length); map.removeOverlays(Acworth); map.removeOverlays(Atlanta); map.removeOverlays(Bellville); map.removeOverlays(Canton); map.removeOverlays(Douglasville); map.removeOverlays(Lawrenceville); map.removeOverlays(Lithonia); map.removeOverlays(Macon); map.removeOverlays(Martinez); map.removeOverlays(Powder_Springs); map.removeOverlays(Roswell); map.removeOverlays(Smyrna); map.removeOverlays(Warrenton); setTimeout(function(){map.addOverlays(Acworth)},1000); setTimeout(function(){map.addOverlays(Atlanta)},1000); setTimeout(function(){map.addOverlays(Bellville)},1000); setTimeout(function(){map.addOverlays(Canton)},1000); setTimeout(function(){map.addOverlays(Douglasville)},1000); setTimeout(function(){map.addOverlays(Lawrenceville)},1000); setTimeout(function(){map.addOverlays(Lithonia)},1000); setTimeout(function(){map.addOverlays(Macon)},1000); setTimeout(function(){map.addOverlays(Martinez)},1000); setTimeout(function(){map.addOverlays(Powder_Springs)},1000); setTimeout(function(){map.addOverlays(Roswell)},1000); setTimeout(function(){map.addOverlays(Smyrna)},1000); setTimeout(function(){map.addOverlays(Warrenton)},1000); maxLng = -81.97440000; maxLat = 34.16088600; minLng = -84.72968500; minLat = 32.15220000; reCenterMap(); } // 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,11); /* 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(Atlanta); map.removeOverlays(Bellville); map.removeOverlays(Canton); map.removeOverlays(Douglasville); map.removeOverlays(Lawrenceville); map.removeOverlays(Lithonia); map.removeOverlays(Macon); map.removeOverlays(Martinez); map.removeOverlays(Powder_Springs); map.removeOverlays(Roswell); map.removeOverlays(Smyrna); map.removeOverlays(Warrenton); 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(Canton);map.removeOverlays(Acworth); map.removeOverlays(Atlanta); map.removeOverlays(Bellville); map.removeOverlays(Canton); map.removeOverlays(Douglasville); map.removeOverlays(Lawrenceville); map.removeOverlays(Lithonia); map.removeOverlays(Macon); map.removeOverlays(Martinez); map.removeOverlays(Powder_Springs); map.removeOverlays(Roswell); map.removeOverlays(Smyrna); map.removeOverlays(Warrenton); map.addOverlays(Acworth); centerByArray(Acworth, false, false); cntMarker += Acworth.length; map.addOverlays(Atlanta); centerByArray(Atlanta, false, false); cntMarker += Atlanta.length; map.addOverlays(Bellville); centerByArray(Bellville, false, false); cntMarker += Bellville.length; map.addOverlays(Canton); centerByArray(Canton, false, false); cntMarker += Canton.length; map.addOverlays(Douglasville); centerByArray(Douglasville, false, false); cntMarker += Douglasville.length; map.addOverlays(Lawrenceville); centerByArray(Lawrenceville, false, false); cntMarker += Lawrenceville.length; map.addOverlays(Lithonia); centerByArray(Lithonia, false, false); cntMarker += Lithonia.length; map.addOverlays(Macon); centerByArray(Macon, false, false); cntMarker += Macon.length; map.addOverlays(Martinez); centerByArray(Martinez, false, false); cntMarker += Martinez.length; map.addOverlays(Powder_Springs); centerByArray(Powder_Springs, false, false); cntMarker += Powder_Springs.length; map.addOverlays(Roswell); centerByArray(Roswell, false, false); cntMarker += Roswell.length; map.addOverlays(Smyrna); centerByArray(Smyrna, false, false); cntMarker += Smyrna.length; map.addOverlays(Warrenton); centerByArray(Warrenton, false, false); cntMarker += Warrenton.length; centerByArray(Canton,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///35371,8031,35370,7683,7629,35371,8031,35373,7758,8003,7897,35370,35374,35369,7683,7985,8029,7818,7629,7635,7573,/all'); //window.open('/map.php?type=2&schools=35371,8031,35370,7683,7629,35371,8031,35373,7758,8003,7897,35370,35374,35369,7683,7985,8029,7818,7629,7635,7573,&school_level=&radius=&zipcode=&school_type_search=&school_type_code='); } } function createMarker(point, label, icon) { var marker = new GMarker(point, icon); var html = label; GEvent.addListener(marker, "click", function() { marker.openInfoWindowHtml(html); }); return marker; }