function addMarkers(){ mySelect = document.getElementById('selection'); Franklin = [];Brentwood = [];Fairview = [];mySelect.options[mySelect.options.length] = new Option("Brentwood schools",'all=Brentwood'); mySelect.options[mySelect.options.length] = new Option("Fairview schools",'all=Fairview'); mySelect.options[mySelect.options.length] = new Option("Franklin schools",'all=Franklin'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Franklin[Franklin.length] = createMarker(new GPoint(-86.86168900,35.94858300),"
Battle Ground Academy
336 Ernest Rice Lane
Franklin, TN 37069
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Battle Ground Academy",'Franklin=' + Franklin.length); Franklin[Franklin.length] = createMarker(new GPoint(-86.88638900,36.00070400),"
Benton Hall Academy
2422 Bethlehem Loop Rd
Franklin, TN 37069
Co-ed school, 3-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Benton Hall Academy",'Franklin=' + Franklin.length); Brentwood[Brentwood.length] = createMarker(new GPoint(-86.81711700,36.03628600),"
Brentwood Academy
219 Granny White Pike
Brentwood, TN 37027
Co-ed school, 6-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Brentwood Academy",'Brentwood=' + Brentwood.length); Brentwood[Brentwood.length] = createMarker(new GPoint(-86.85622900,36.02804200),"
Currey Ingram Academy
6544 Murray Lane
Brentwood, TN 37027
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Currey Ingram Academy",'Brentwood=' + Brentwood.length); Franklin[Franklin.length] = createMarker(new GPoint(-86.88714900,35.93445800),"
Eagles Nest Academy
810 Del Rio Pike
Franklin, TN 37064
Co-ed school, PK-7
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Eagles Nest Academy",'Franklin=' + Franklin.length); Fairview[Fairview.length] = createMarker(new GPoint(-87.16214100,35.93878000),"
Faith Apostolic Christian School
2886 Fairview Blvd
Fairview, TN 37062
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Faith Apostolic Christian School",'Fairview=' + Fairview.length); Franklin[Franklin.length] = createMarker(new GPoint(-86.87093000,35.92425200),"
Franklin Classical School
Po Box 1601
Franklin, TN 37065
Co-ed school, 5-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Franklin Classical School",'Franklin=' + Franklin.length); Franklin[Franklin.length] = createMarker(new GPoint(-86.88433800,35.91440400),"
Montessori School Of Franklin
1325 West Main Street Suite G
Franklin, TN 37064
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Montessori School Of Franklin",'Franklin=' + Franklin.length); Franklin[Franklin.length] = createMarker(new GPoint(-86.89970100,35.92058800),"
New Hope Academy
1820 Downs Blvd
Franklin, TN 37064
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("New Hope Academy",'Franklin=' + Franklin.length); Franklin[Franklin.length] = createMarker(new GPoint(-86.95590900,36.03063000),"
St Matthew Catholic School
533 Sneed Road W
Franklin, TN 37069
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Matthew Catholic School",'Franklin=' + Franklin.length); Franklin[Franklin.length] = createMarker(new GPoint(-86.95443000,35.85915000),"
Willow Hall Academy
4092 Carters Creek Pike
Franklin, TN 37064
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Willow Hall Academy",'Franklin=' + Franklin.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,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/////3/' + showArray); map.removeOverlays(Brentwood); map.removeOverlays(Fairview); map.removeOverlays(Franklin); 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(Franklin);map.removeOverlays(Brentwood); map.removeOverlays(Fairview); map.removeOverlays(Franklin); map.addOverlays(Brentwood); centerByArray(Brentwood, false, false); cntMarker += Brentwood.length; map.addOverlays(Fairview); centerByArray(Fairview, false, false); cntMarker += Fairview.length; map.addOverlays(Franklin); centerByArray(Franklin, false, false); cntMarker += Franklin.length; centerByArray(Franklin,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'); //window.open('/map.php?type=1&schools=&school_level=3&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; }