function addMarkers(){ mySelect = document.getElementById('selection'); Decatur = [];Newnan = [];Marietta = [];Norcross = [];Alpharetta = [];Fayetteville = [];Lagrange = [];Martinez = [];Macon = [];Douglasville = [];Lawrenceville = [];Gainesville = [];mySelect.options[mySelect.options.length] = new Option("Alpharetta schools",'all=Alpharetta'); mySelect.options[mySelect.options.length] = new Option("Decatur schools",'all=Decatur'); mySelect.options[mySelect.options.length] = new Option("Douglasville schools",'all=Douglasville'); mySelect.options[mySelect.options.length] = new Option("Fayetteville schools",'all=Fayetteville'); mySelect.options[mySelect.options.length] = new Option("Gainesville schools",'all=Gainesville'); mySelect.options[mySelect.options.length] = new Option("Lagrange schools",'all=Lagrange'); mySelect.options[mySelect.options.length] = new Option("Lawrenceville schools",'all=Lawrenceville'); mySelect.options[mySelect.options.length] = new Option("Macon schools",'all=Macon'); mySelect.options[mySelect.options.length] = new Option("Marietta schools",'all=Marietta'); mySelect.options[mySelect.options.length] = new Option("Martinez schools",'all=Martinez'); mySelect.options[mySelect.options.length] = new Option("Newnan schools",'all=Newnan'); mySelect.options[mySelect.options.length] = new Option("Norcross schools",'all=Norcross'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Decatur[Decatur.length] = createMarker(new GPoint(-84.28446200,33.82548100),"
Arbor Montessori
2998 Lavista Road
Decatur, GA 30033
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Arbor Montessori",'Decatur=' + Decatur.length); Newnan[Newnan.length] = createMarker(new GPoint(-84.80119900,33.38943300),"
Carolyn Barron Montessori
195 Jackson Street
Newnan, GA 30263
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Carolyn Barron Montessori",'Newnan=' + Newnan.length); Marietta[Marietta.length] = createMarker(new GPoint(-84.50535600,33.94800900),"
Casa Del Bambini
150 Powers Ferry Road
Marietta, GA 30067
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Casa Del Bambini",'Marietta=' + Marietta.length); Norcross[Norcross.length] = createMarker(new GPoint(-84.21197400,33.92481000),"
Country Brook Montessori School
2175 Norcross Tucker Road
Norcross, GA 30071
Co-ed school, PK-4
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Country Brook Montessori School",'Norcross=' + Norcross.length); Alpharetta[Alpharetta.length] = createMarker(new GPoint(-84.35576900,34.08455100),"
Crabapple Montessori School
12387 Crabapple Road
Alpharetta, GA 30004
Co-ed school, NS-PK
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Crabapple Montessori School",'Alpharetta=' + Alpharetta.length); Decatur[Decatur.length] = createMarker(new GPoint(-84.28746200,33.78942000),"
Decatur Montessori
1429 Church Street
Decatur, GA 30030
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Decatur Montessori",'Decatur=' + Decatur.length); Fayetteville[Fayetteville.length] = createMarker(new GPoint(-84.43486500,33.45333300),"
Fayette Montessori School
190 Weatherly Drive
Fayetteville, GA 30214
Co-ed school, PK-5
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Fayette Montessori School",'Fayetteville=' + Fayetteville.length); Lagrange[Lagrange.length] = createMarker(new GPoint(-85.03244700,33.03963000),"
First Presbyterian Montessori Preschool And Kdgn
120 Broad Street
Lagrange, GA 30240
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("First Presbyterian Montessori Preschool And Kdgn",'Lagrange=' + Lagrange.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); Alpharetta[Alpharetta.length] = createMarker(new GPoint(-84.18984600,34.02738800),"
Medlock Bridge Montessori
10100 Medlock Bridge Parkway
Alpharetta, GA 30022
Co-ed school, NS-PK
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Medlock Bridge Montessori",'Alpharetta=' + Alpharetta.length); Macon[Macon.length] = createMarker(new GPoint(-83.69018400,32.86828600),"
Montessori Of Macon
436 Forest Hill Road
Macon, GA 31210
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Montessori Of Macon",'Macon=' + Macon.length); Decatur[Decatur.length] = createMarker(new GPoint(-84.26953900,33.79367000),"
Montessori School At Emory
3021 North Decatur Rd
Decatur, GA 30033
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Montessori School At Emory",'Decatur=' + Decatur.length); Douglasville[Douglasville.length] = createMarker(new GPoint(-84.72643400,33.76168800),"
Montessori School Of Douglas County
8014 Duralee Lane
Douglasville, GA 30134
Co-ed school, PK-3
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Montessori School Of Douglas County",'Douglasville=' + Douglasville.length); Lawrenceville[Lawrenceville.length] = createMarker(new GPoint(-84.01384600,34.01608600),"
Oak Meadow Montessori
2145 Collins Hill Road
Lawrenceville, GA 30043
Co-ed school, NS-4
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Oak Meadow Montessori",'Lawrenceville=' + Lawrenceville.length); Alpharetta[Alpharetta.length] = createMarker(new GPoint(-84.25994900,34.06915200),"
Preston Ridge Montessori
3800 Northpoint Parkway
Alpharetta, GA 30005
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Preston Ridge Montessori",'Alpharetta=' + Alpharetta.length); Gainesville[Gainesville.length] = createMarker(new GPoint(-83.83400400,34.33869900),"
Riverside Military Academy
2001 Riverside Drive
Gainesville, GA 30501
All-boys school, 6-12
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Riverside Military Academy",'Gainesville=' + Gainesville.length); Macon[Macon.length] = createMarker(new GPoint(-83.74577100,32.88959000),"
St Andrew's Montessori Preschool
501 Bass Road
Macon, GA 31210
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Andrew's Montessori Preschool",'Macon=' + Macon.length); map.removeOverlays(Alpharetta); map.removeOverlays(Decatur); map.removeOverlays(Douglasville); map.removeOverlays(Fayetteville); map.removeOverlays(Gainesville); map.removeOverlays(Lagrange); map.removeOverlays(Lawrenceville); map.removeOverlays(Macon); map.removeOverlays(Marietta); map.removeOverlays(Martinez); map.removeOverlays(Newnan); map.removeOverlays(Norcross); setTimeout(function(){map.addOverlays(Alpharetta)},1000); setTimeout(function(){map.addOverlays(Decatur)},1000); setTimeout(function(){map.addOverlays(Douglasville)},1000); setTimeout(function(){map.addOverlays(Fayetteville)},1000); setTimeout(function(){map.addOverlays(Gainesville)},1000); setTimeout(function(){map.addOverlays(Lagrange)},1000); setTimeout(function(){map.addOverlays(Lawrenceville)},1000); setTimeout(function(){map.addOverlays(Macon)},1000); setTimeout(function(){map.addOverlays(Marietta)},1000); setTimeout(function(){map.addOverlays(Martinez)},1000); setTimeout(function(){map.addOverlays(Newnan)},1000); setTimeout(function(){map.addOverlays(Norcross)},1000); maxLng = -82.09135600; maxLat = 34.33869900; minLng = -85.03244700; minLat = 32.86828600; 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(Alpharetta); map.removeOverlays(Decatur); map.removeOverlays(Douglasville); map.removeOverlays(Fayetteville); map.removeOverlays(Gainesville); map.removeOverlays(Lagrange); map.removeOverlays(Lawrenceville); map.removeOverlays(Macon); map.removeOverlays(Marietta); map.removeOverlays(Martinez); map.removeOverlays(Newnan); map.removeOverlays(Norcross); 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(Decatur);map.removeOverlays(Alpharetta); map.removeOverlays(Decatur); map.removeOverlays(Douglasville); map.removeOverlays(Fayetteville); map.removeOverlays(Gainesville); map.removeOverlays(Lagrange); map.removeOverlays(Lawrenceville); map.removeOverlays(Macon); map.removeOverlays(Marietta); map.removeOverlays(Martinez); map.removeOverlays(Newnan); map.removeOverlays(Norcross); map.addOverlays(Alpharetta); centerByArray(Alpharetta, false, false); cntMarker += Alpharetta.length; map.addOverlays(Decatur); centerByArray(Decatur, false, false); cntMarker += Decatur.length; map.addOverlays(Douglasville); centerByArray(Douglasville, false, false); cntMarker += Douglasville.length; map.addOverlays(Fayetteville); centerByArray(Fayetteville, false, false); cntMarker += Fayetteville.length; map.addOverlays(Gainesville); centerByArray(Gainesville, false, false); cntMarker += Gainesville.length; map.addOverlays(Lagrange); centerByArray(Lagrange, false, false); cntMarker += Lagrange.length; map.addOverlays(Lawrenceville); centerByArray(Lawrenceville, false, false); cntMarker += Lawrenceville.length; map.addOverlays(Macon); centerByArray(Macon, false, false); cntMarker += Macon.length; map.addOverlays(Marietta); centerByArray(Marietta, false, false); cntMarker += Marietta.length; map.addOverlays(Martinez); centerByArray(Martinez, false, false); cntMarker += Martinez.length; map.addOverlays(Newnan); centerByArray(Newnan, false, false); cntMarker += Newnan.length; map.addOverlays(Norcross); centerByArray(Norcross, false, false); cntMarker += Norcross.length; centerByArray(Decatur,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///7916,34745,34744,7899,7533,7657,7827,7826,8067,34743,7861,7824,7951,34742,8029,7593,7631,/all'); //window.open('/map.php?type=2&schools=7916,34745,34744,7899,7533,7657,7827,7826,8067,34743,7861,7824,7951,34742,8029,7593,7631,&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; }