function addMarkers(){ mySelect = document.getElementById('selection'); Knoxville = [];Kingsport = [];Murfreesboro = [];Gallatin = [];Summertown = [];La_Grange = [];Morristown = [];Athens = [];Nashville = [];Grand_Junction = [];Rutledge = [];Arthur = [];Cleveland = [];mySelect.options[mySelect.options.length] = new Option("Arthur schools",'all=Arthur'); mySelect.options[mySelect.options.length] = new Option("Athens schools",'all=Athens'); mySelect.options[mySelect.options.length] = new Option("Cleveland schools",'all=Cleveland'); mySelect.options[mySelect.options.length] = new Option("Gallatin schools",'all=Gallatin'); mySelect.options[mySelect.options.length] = new Option("Grand Junction schools",'all=Grand_Junction'); mySelect.options[mySelect.options.length] = new Option("Kingsport schools",'all=Kingsport'); mySelect.options[mySelect.options.length] = new Option("Knoxville schools",'all=Knoxville'); mySelect.options[mySelect.options.length] = new Option("La Grange schools",'all=La_Grange'); mySelect.options[mySelect.options.length] = new Option("Morristown schools",'all=Morristown'); mySelect.options[mySelect.options.length] = new Option("Murfreesboro schools",'all=Murfreesboro'); mySelect.options[mySelect.options.length] = new Option("Nashville schools",'all=Nashville'); mySelect.options[mySelect.options.length] = new Option("Rutledge schools",'all=Rutledge'); mySelect.options[mySelect.options.length] = new Option("Summertown schools",'all=Summertown'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Knoxville[Knoxville.length] = createMarker(new GPoint(-83.98817800,35.98650700),"
Apostolic Christian School
5020 Pleasant Ridge Road
Knoxville, TN 37912
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Apostolic Christian School",'Knoxville=' + Knoxville.length); Kingsport[Kingsport.length] = createMarker(new GPoint(-82.59066300,36.57006900),"
Apostolic Gospel Academy
1780 Granby Road
Kingsport, TN 37660
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Apostolic Gospel Academy",'Kingsport=' + Kingsport.length); Knoxville[Knoxville.length] = createMarker(new GPoint(-83.89107600,36.00779600),"
Berean Christian School
2329 Prosser Rd
Knoxville, TN 37914
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Berean Christian School",'Knoxville=' + Knoxville.length); Murfreesboro[Murfreesboro.length] = createMarker(new GPoint(-86.29996700,35.78539100),"
Bible Church Academy
6371 Bradyville Pike
Murfreesboro, TN 37127
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bible Church Academy",'Murfreesboro=' + Murfreesboro.length); Knoxville[Knoxville.length] = createMarker(new GPoint(-83.92082800,35.96052300),"
Christian Family Cooperative
P.O. Box 31733
Knoxville, TN 37930
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Christian Family Cooperative",'Knoxville=' + Knoxville.length); Knoxville[Knoxville.length] = createMarker(new GPoint(-83.95887800,35.95526400),"
Columbus Home School
3227 Division Street
Knoxville, TN 37919
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Columbus Home School",'Knoxville=' + Knoxville.length); Gallatin[Gallatin.length] = createMarker(new GPoint(-86.46066900,36.38111000),"
Declaration Christian Academy
Po Box 8075 1823 W Lori Lee Drive
Gallatin, TN 37066
Co-ed school, 7-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Declaration Christian Academy",'Gallatin=' + Gallatin.length); Summertown[Summertown.length] = createMarker(new GPoint(-87.32880100,35.47871900),"
The Farm School
151 Schoolhouse Road
Summertown, TN 38483
Co-ed school, K-10
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The Farm School",'Summertown=' + Summertown.length); La_Grange[La_Grange.length] = createMarker(new GPoint(-89.24359200,35.04896000),"
La Grange Montessori School
Po Box 365
La Grange, TN 38046
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("La Grange Montessori School",'La_Grange=' + La_Grange.length); Morristown[Morristown.length] = createMarker(new GPoint(-83.34261000,36.20249100),"
Lakeway Christian School
415 Central Church Road
Morristown, TN 37814
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Lakeway Christian School",'Morristown=' + Morristown.length); Athens[Athens.length] = createMarker(new GPoint(-84.62230000,35.44230000),"
Liberty Christian
Po Box 1555
Athens, TN 37371
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Liberty Christian",'Athens=' + Athens.length); Morristown[Morristown.length] = createMarker(new GPoint(-83.29500000,36.21380000),"
Morristown Covenant Academy
Po Box 1737 502 S Jackson Street
Morristown, TN 37816
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Morristown Covenant Academy",'Morristown=' + Morristown.length); Nashville[Nashville.length] = createMarker(new GPoint(-86.75761100,36.25424500),"
Nashville Christian Advancement Academy
3551 Dickerson Pike
Nashville, TN 37207
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Nashville Christian Advancement Academy",'Nashville=' + Nashville.length); Grand_Junction[Grand_Junction.length] = createMarker(new GPoint(-89.02470000,35.10540000),"
New Life Christian Academy
4275 Highway 57 E
Grand Junction, TN 38039
Co-ed school, 1-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("New Life Christian Academy",'Grand_Junction=' + Grand_Junction.length); Rutledge[Rutledge.length] = createMarker(new GPoint(-83.54316100,36.19141400),"
New System School, Inc.
250 Tampico Church Road
Rutledge, TN 37861
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("New System School, Inc.",'Rutledge=' + Rutledge.length); Nashville[Nashville.length] = createMarker(new GPoint(-86.72265400,36.05924100),"
St Clement Coptic Orthodox Christian Academy
476 Mcmurray Drive
Nashville, TN 37211
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Clement Coptic Orthodox Christian Academy",'Nashville=' + Nashville.length); Arthur[Arthur.length] = createMarker(new GPoint(-83.67080000,36.54800000),"
Tri-state Christian Academy
Po Box 206
Arthur, TN 37707
Co-ed school, PK-7
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Tri-state Christian Academy",'Arthur=' + Arthur.length); Cleveland[Cleveland.length] = createMarker(new GPoint(-84.86500000,35.10560000),"
United Christian Academy
Po Box 700
Cleveland, TN 37364
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("United Christian Academy",'Cleveland=' + Cleveland.length); map.removeOverlays(Arthur); map.removeOverlays(Athens); map.removeOverlays(Cleveland); map.removeOverlays(Gallatin); map.removeOverlays(Grand_Junction); map.removeOverlays(Kingsport); map.removeOverlays(Knoxville); map.removeOverlays(La_Grange); map.removeOverlays(Morristown); map.removeOverlays(Murfreesboro); map.removeOverlays(Nashville); map.removeOverlays(Rutledge); map.removeOverlays(Summertown); setTimeout(function(){map.addOverlays(Arthur)},1000); setTimeout(function(){map.addOverlays(Athens)},1000); setTimeout(function(){map.addOverlays(Cleveland)},1000); setTimeout(function(){map.addOverlays(Gallatin)},1000); setTimeout(function(){map.addOverlays(Grand_Junction)},1000); setTimeout(function(){map.addOverlays(Kingsport)},1000); setTimeout(function(){map.addOverlays(Knoxville)},1000); setTimeout(function(){map.addOverlays(La_Grange)},1000); setTimeout(function(){map.addOverlays(Morristown)},1000); setTimeout(function(){map.addOverlays(Murfreesboro)},1000); setTimeout(function(){map.addOverlays(Nashville)},1000); setTimeout(function(){map.addOverlays(Rutledge)},1000); setTimeout(function(){map.addOverlays(Summertown)},1000); maxLng = -82.59066300; maxLat = 36.57006900; minLng = -89.24359200; minLat = 35.04896000; 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(Arthur); map.removeOverlays(Athens); map.removeOverlays(Cleveland); map.removeOverlays(Gallatin); map.removeOverlays(Grand_Junction); map.removeOverlays(Kingsport); map.removeOverlays(Knoxville); map.removeOverlays(La_Grange); map.removeOverlays(Morristown); map.removeOverlays(Murfreesboro); map.removeOverlays(Nashville); map.removeOverlays(Rutledge); map.removeOverlays(Summertown); 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(Knoxville);map.removeOverlays(Arthur); map.removeOverlays(Athens); map.removeOverlays(Cleveland); map.removeOverlays(Gallatin); map.removeOverlays(Grand_Junction); map.removeOverlays(Kingsport); map.removeOverlays(Knoxville); map.removeOverlays(La_Grange); map.removeOverlays(Morristown); map.removeOverlays(Murfreesboro); map.removeOverlays(Nashville); map.removeOverlays(Rutledge); map.removeOverlays(Summertown); map.addOverlays(Arthur); centerByArray(Arthur, false, false); cntMarker += Arthur.length; map.addOverlays(Athens); centerByArray(Athens, false, false); cntMarker += Athens.length; map.addOverlays(Cleveland); centerByArray(Cleveland, false, false); cntMarker += Cleveland.length; map.addOverlays(Gallatin); centerByArray(Gallatin, false, false); cntMarker += Gallatin.length; map.addOverlays(Grand_Junction); centerByArray(Grand_Junction, false, false); cntMarker += Grand_Junction.length; map.addOverlays(Kingsport); centerByArray(Kingsport, false, false); cntMarker += Kingsport.length; map.addOverlays(Knoxville); centerByArray(Knoxville, false, false); cntMarker += Knoxville.length; map.addOverlays(La_Grange); centerByArray(La_Grange, false, false); cntMarker += La_Grange.length; map.addOverlays(Morristown); centerByArray(Morristown, false, false); cntMarker += Morristown.length; map.addOverlays(Murfreesboro); centerByArray(Murfreesboro, false, false); cntMarker += Murfreesboro.length; map.addOverlays(Nashville); centerByArray(Nashville, false, false); cntMarker += Nashville.length; map.addOverlays(Rutledge); centerByArray(Rutledge, false, false); cntMarker += Rutledge.length; map.addOverlays(Summertown); centerByArray(Summertown, false, false); cntMarker += Summertown.length; centerByArray(Knoxville,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///26161,33219,33212,26391,25933,26151,26205,25935,34478,26335,26353,26161,26358,26222,33212,26391,25933,25989,26100,31825,26151,26205,25935,33224,36094,34478,26335,/all'); //window.open('/map.php?type=2&schools=26161,33219,33212,26391,25933,26151,26205,25935,34478,26335,26353,26161,26358,26222,33212,26391,25933,25989,26100,31825,26151,26205,25935,33224,36094,34478,26335,&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; }