function addMarkers(){ mySelect = document.getElementById('selection'); Norcross = [];Valdosta = [];Augusta = [];Mcdonough = [];Gracewood = [];La_Grange = [];Stockbridge = [];Manchester = [];Fayetteville = [];Suwanee = [];mySelect.options[mySelect.options.length] = new Option("Augusta schools",'all=Augusta'); mySelect.options[mySelect.options.length] = new Option("Fayetteville schools",'all=Fayetteville'); mySelect.options[mySelect.options.length] = new Option("Gracewood schools",'all=Gracewood'); mySelect.options[mySelect.options.length] = new Option("La Grange schools",'all=La_Grange'); mySelect.options[mySelect.options.length] = new Option("Manchester schools",'all=Manchester'); mySelect.options[mySelect.options.length] = new Option("Mcdonough schools",'all=Mcdonough'); mySelect.options[mySelect.options.length] = new Option("Norcross schools",'all=Norcross'); mySelect.options[mySelect.options.length] = new Option("Stockbridge schools",'all=Stockbridge'); mySelect.options[mySelect.options.length] = new Option("Suwanee schools",'all=Suwanee'); mySelect.options[mySelect.options.length] = new Option("Valdosta schools",'all=Valdosta'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Norcross[Norcross.length] = createMarker(new GPoint(-84.23031000,33.97623400),"
Cornerstone Christian Academy
5295 Triangle Parkway
Norcross, GA 30092
Co-ed school, K-7
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Cornerstone Christian Academy",'Norcross=' + Norcross.length); Valdosta[Valdosta.length] = createMarker(new GPoint(-83.30533900,30.86922200),"
Crossroads Baptist School
3001 Country Club Drive
Valdosta, GA 31602
Co-ed school, PK-5
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Crossroads Baptist School",'Valdosta=' + Valdosta.length); Augusta[Augusta.length] = createMarker(new GPoint(-82.00772100,33.48985500),"
Curtis Baptist School (pk-12)
2230 Broad St
Augusta, GA 30901
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Curtis Baptist School (pk-12)",'Augusta=' + Augusta.length); Mcdonough[Mcdonough.length] = createMarker(new GPoint(-84.18621800,33.50515500),"
Eagle's Landing Christian Academy
2400 Highway 42 N
Mcdonough, GA 30253
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Eagle's Landing Christian Academy",'Mcdonough=' + Mcdonough.length); Gracewood[Gracewood.length] = createMarker(new GPoint(-82.03220000,33.37250000),"
The First Academy
Po Box 26
Gracewood, GA 30812
Co-ed school, PK-9
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The First Academy",'Gracewood=' + Gracewood.length); La_Grange[La_Grange.length] = createMarker(new GPoint(-85.03797800,33.03936300),"
First United Methodist - Elc
401 Broad Street
La Grange, GA 30240
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("First United Methodist - Elc",'La_Grange=' + La_Grange.length); Stockbridge[Stockbridge.length] = createMarker(new GPoint(-84.16118600,33.58116000),"
Mount Vernon Christian School
2178 Highway 138
Stockbridge, GA 30281
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mount Vernon Christian School",'Stockbridge=' + Stockbridge.length); Manchester[Manchester.length] = createMarker(new GPoint(-84.67048500,32.84227600),"
Mountain Top Christian
5304 Scenic Heights Rd
Manchester, GA 31816
Co-ed school, KG-10
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mountain Top Christian",'Manchester=' + Manchester.length); Fayetteville[Fayetteville.length] = createMarker(new GPoint(-84.46940000,33.47370000),"
Pace Christian School
Po Box 142068
Fayetteville, GA 30214
Co-ed school, KG-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Pace Christian School",'Fayetteville=' + Fayetteville.length); Suwanee[Suwanee.length] = createMarker(new GPoint(-84.07744700,34.05493100),"
Redeemer Christian Academy
641 Eva Kennedy Rd
Suwanee, GA 30024
Co-ed school, KG-9
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Redeemer Christian Academy",'Suwanee=' + Suwanee.length); map.removeOverlays(Augusta); map.removeOverlays(Fayetteville); map.removeOverlays(Gracewood); map.removeOverlays(La_Grange); map.removeOverlays(Manchester); map.removeOverlays(Mcdonough); map.removeOverlays(Norcross); map.removeOverlays(Stockbridge); map.removeOverlays(Suwanee); map.removeOverlays(Valdosta); setTimeout(function(){map.addOverlays(Augusta)},1000); setTimeout(function(){map.addOverlays(Fayetteville)},1000); setTimeout(function(){map.addOverlays(Gracewood)},1000); setTimeout(function(){map.addOverlays(La_Grange)},1000); setTimeout(function(){map.addOverlays(Manchester)},1000); setTimeout(function(){map.addOverlays(Mcdonough)},1000); setTimeout(function(){map.addOverlays(Norcross)},1000); setTimeout(function(){map.addOverlays(Stockbridge)},1000); setTimeout(function(){map.addOverlays(Suwanee)},1000); setTimeout(function(){map.addOverlays(Valdosta)},1000); maxLng = -82.00772100; maxLat = 34.05493100; minLng = -85.03797800; minLat = 30.86922200; 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(Augusta); map.removeOverlays(Fayetteville); map.removeOverlays(Gracewood); map.removeOverlays(La_Grange); map.removeOverlays(Manchester); map.removeOverlays(Mcdonough); map.removeOverlays(Norcross); map.removeOverlays(Stockbridge); map.removeOverlays(Suwanee); map.removeOverlays(Valdosta); 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(Norcross);map.removeOverlays(Augusta); map.removeOverlays(Fayetteville); map.removeOverlays(Gracewood); map.removeOverlays(La_Grange); map.removeOverlays(Manchester); map.removeOverlays(Mcdonough); map.removeOverlays(Norcross); map.removeOverlays(Stockbridge); map.removeOverlays(Suwanee); map.removeOverlays(Valdosta); map.addOverlays(Augusta); centerByArray(Augusta, false, false); cntMarker += Augusta.length; map.addOverlays(Fayetteville); centerByArray(Fayetteville, false, false); cntMarker += Fayetteville.length; map.addOverlays(Gracewood); centerByArray(Gracewood, false, false); cntMarker += Gracewood.length; map.addOverlays(La_Grange); centerByArray(La_Grange, false, false); cntMarker += La_Grange.length; map.addOverlays(Manchester); centerByArray(Manchester, false, false); cntMarker += Manchester.length; map.addOverlays(Mcdonough); centerByArray(Mcdonough, false, false); cntMarker += Mcdonough.length; map.addOverlays(Norcross); centerByArray(Norcross, false, false); cntMarker += Norcross.length; map.addOverlays(Stockbridge); centerByArray(Stockbridge, false, false); cntMarker += Stockbridge.length; map.addOverlays(Suwanee); centerByArray(Suwanee, false, false); cntMarker += Suwanee.length; map.addOverlays(Valdosta); centerByArray(Valdosta, false, false); cntMarker += Valdosta.length; centerByArray(Norcross,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///7648,8068,7839,34198,7836,7912,7648,7876,8068,7700,7839,34198,7888,7836,7912,7551,/all'); //window.open('/map.php?type=2&schools=7648,8068,7839,34198,7836,7912,7648,7876,8068,7700,7839,34198,7888,7836,7912,7551,&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; }