function addMarkers(){ mySelect = document.getElementById('selection'); Chattanooga = [];Camden = [];Nashville = [];Spring_City = [];Smyrna = [];Henderson = [];Memphis = [];Louisville = [];Cookeville = [];Sewanee = [];Johnson_City = [];Martin = [];Bell_Buckle = [];mySelect.options[mySelect.options.length] = new Option("Bell Buckle schools",'all=Bell_Buckle'); mySelect.options[mySelect.options.length] = new Option("Camden schools",'all=Camden'); mySelect.options[mySelect.options.length] = new Option("Chattanooga schools",'all=Chattanooga'); mySelect.options[mySelect.options.length] = new Option("Cookeville schools",'all=Cookeville'); mySelect.options[mySelect.options.length] = new Option("Henderson schools",'all=Henderson'); mySelect.options[mySelect.options.length] = new Option("Johnson City schools",'all=Johnson_City'); mySelect.options[mySelect.options.length] = new Option("Louisville schools",'all=Louisville'); mySelect.options[mySelect.options.length] = new Option("Martin schools",'all=Martin'); mySelect.options[mySelect.options.length] = new Option("Memphis schools",'all=Memphis'); mySelect.options[mySelect.options.length] = new Option("Nashville schools",'all=Nashville'); mySelect.options[mySelect.options.length] = new Option("Sewanee schools",'all=Sewanee'); mySelect.options[mySelect.options.length] = new Option("Smyrna schools",'all=Smyrna'); mySelect.options[mySelect.options.length] = new Option("Spring City schools",'all=Spring_City'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Chattanooga[Chattanooga.length] = createMarker(new GPoint(-85.30810000,35.04550000),"
Baylor School
171 Baylor School Road
Chattanooga, TN 37405
Co-ed school, 6-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Baylor School",'Chattanooga=' + Chattanooga.length); Camden[Camden.length] = createMarker(new GPoint(-88.09980000,36.04690000),"
Camden Christian Academy
Po Box 179
Camden, TN 38320
Co-ed school, 6-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Camden Christian Academy",'Camden=' + Camden.length); Nashville[Nashville.length] = createMarker(new GPoint(-86.83864700,36.10302700),"
Harpeth Hall School
3801 Hobbs Road
Nashville, TN 37215
All-girls school, 5-12
[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Harpeth Hall School",'Nashville=' + Nashville.length); Spring_City[Spring_City.length] = createMarker(new GPoint(-84.87616100,35.67304600),"
King Memorial Seventh Day Adve
1548 Cemetery Road
Spring City, TN 37381
Co-ed school, 4-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("King Memorial Seventh Day Adve",'Spring_City=' + Spring_City.length); Smyrna[Smyrna.length] = createMarker(new GPoint(-86.51036700,35.97887000),"
Lancaster Christian Academy
150 Soccer Way
Smyrna, TN 37167
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Lancaster Christian Academy",'Smyrna=' + Smyrna.length); Chattanooga[Chattanooga.length] = createMarker(new GPoint(-85.26477900,35.03002700),"
Mccallie School
500 Dodds Avenue
Chattanooga, TN 37404
All-boys school, 6-12
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Mccallie School",'Chattanooga=' + Chattanooga.length); Henderson[Henderson.length] = createMarker(new GPoint(-88.66060000,35.42480000),"
Miracle Temple Christian Academy
761 U S Hwy 45 Bypass North
Henderson, TN 38340
Co-ed school, KG-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Miracle Temple Christian Academy",'Henderson=' + Henderson.length); Memphis[Memphis.length] = createMarker(new GPoint(-90.02208400,35.22643300),"
Our Lady Of Sorrows Elementary School
3690 Thomas Street
Memphis, TN 38127
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Our Lady Of Sorrows Elementary School",'Memphis=' + Memphis.length); Louisville[Louisville.length] = createMarker(new GPoint(-84.00850000,35.83760000),"
Peninsula Village School
Box 100 Jones Bend Rd
Louisville, TN 37777
Co-ed school, 7-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Peninsula Village School",'Louisville=' + Louisville.length); Cookeville[Cookeville.length] = createMarker(new GPoint(-85.53320000,36.21390000),"
Plateau Mental Health/adapt
Po Box 3165
Cookeville, TN 38502
All-boys school, 7-12
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Plateau Mental Health/adapt",'Cookeville=' + Cookeville.length); Sewanee[Sewanee.length] = createMarker(new GPoint(-85.89114400,35.21747400),"
St. Andrew's-Sewanee School
290 Quintard Rd
Sewanee, TN 37375
Co-ed school, 6-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Andrew's-Sewanee School",'Sewanee=' + Sewanee.length); Memphis[Memphis.length] = createMarker(new GPoint(-89.88855100,35.12420100),"
St. Louis Elementary School
5192 Shady Grove Road
Memphis, TN 38117
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Louis Elementary School",'Memphis=' + Memphis.length); Johnson_City[Johnson_City.length] = createMarker(new GPoint(-82.33940000,36.33220000),"
Solid Rock Academy
227 E Market Stpo Box 1937
Johnson City, TN 37601
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Solid Rock Academy",'Johnson_City=' + Johnson_City.length); Martin[Martin.length] = createMarker(new GPoint(-88.84715100,36.34508500),"
Unity Christian School
520 North Mccomb
Martin, TN 38237
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Unity Christian School",'Martin=' + Martin.length); Bell_Buckle[Bell_Buckle.length] = createMarker(new GPoint(-86.34676800,35.55967200),"
The Webb School
P.O. Box 488
Bell Buckle, TN 37020
Co-ed school, 6-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The Webb School",'Bell_Buckle=' + Bell_Buckle.length); map.removeOverlays(Bell_Buckle); map.removeOverlays(Camden); map.removeOverlays(Chattanooga); map.removeOverlays(Cookeville); map.removeOverlays(Henderson); map.removeOverlays(Johnson_City); map.removeOverlays(Louisville); map.removeOverlays(Martin); map.removeOverlays(Memphis); map.removeOverlays(Nashville); map.removeOverlays(Sewanee); map.removeOverlays(Smyrna); map.removeOverlays(Spring_City); setTimeout(function(){map.addOverlays(Bell_Buckle)},1000); setTimeout(function(){map.addOverlays(Camden)},1000); setTimeout(function(){map.addOverlays(Chattanooga)},1000); setTimeout(function(){map.addOverlays(Cookeville)},1000); setTimeout(function(){map.addOverlays(Henderson)},1000); setTimeout(function(){map.addOverlays(Johnson_City)},1000); setTimeout(function(){map.addOverlays(Louisville)},1000); setTimeout(function(){map.addOverlays(Martin)},1000); setTimeout(function(){map.addOverlays(Memphis)},1000); setTimeout(function(){map.addOverlays(Nashville)},1000); setTimeout(function(){map.addOverlays(Sewanee)},1000); setTimeout(function(){map.addOverlays(Smyrna)},1000); setTimeout(function(){map.addOverlays(Spring_City)},1000); maxLng = -82.33940000; maxLat = 36.34508500; minLng = -90.02208400; minLat = 35.03002700; 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(Bell_Buckle); map.removeOverlays(Camden); map.removeOverlays(Chattanooga); map.removeOverlays(Cookeville); map.removeOverlays(Henderson); map.removeOverlays(Johnson_City); map.removeOverlays(Louisville); map.removeOverlays(Martin); map.removeOverlays(Memphis); map.removeOverlays(Nashville); map.removeOverlays(Sewanee); map.removeOverlays(Smyrna); map.removeOverlays(Spring_City); 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(Chattanooga);map.removeOverlays(Bell_Buckle); map.removeOverlays(Camden); map.removeOverlays(Chattanooga); map.removeOverlays(Cookeville); map.removeOverlays(Henderson); map.removeOverlays(Johnson_City); map.removeOverlays(Louisville); map.removeOverlays(Martin); map.removeOverlays(Memphis); map.removeOverlays(Nashville); map.removeOverlays(Sewanee); map.removeOverlays(Smyrna); map.removeOverlays(Spring_City); map.addOverlays(Bell_Buckle); centerByArray(Bell_Buckle, false, false); cntMarker += Bell_Buckle.length; map.addOverlays(Camden); centerByArray(Camden, false, false); cntMarker += Camden.length; map.addOverlays(Chattanooga); centerByArray(Chattanooga, false, false); cntMarker += Chattanooga.length; map.addOverlays(Cookeville); centerByArray(Cookeville, false, false); cntMarker += Cookeville.length; map.addOverlays(Henderson); centerByArray(Henderson, false, false); cntMarker += Henderson.length; map.addOverlays(Johnson_City); centerByArray(Johnson_City, false, false); cntMarker += Johnson_City.length; map.addOverlays(Louisville); centerByArray(Louisville, false, false); cntMarker += Louisville.length; map.addOverlays(Martin); centerByArray(Martin, false, false); cntMarker += Martin.length; map.addOverlays(Memphis); centerByArray(Memphis, false, false); cntMarker += Memphis.length; map.addOverlays(Nashville); centerByArray(Nashville, false, false); cntMarker += Nashville.length; map.addOverlays(Sewanee); centerByArray(Sewanee, false, false); cntMarker += Sewanee.length; map.addOverlays(Smyrna); centerByArray(Smyrna, false, false); cntMarker += Smyrna.length; map.addOverlays(Spring_City); centerByArray(Spring_City, false, false); cntMarker += Spring_City.length; centerByArray(Chattanooga,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///26341,25961,25928,26180,26097,26193,26370,26239,26359,26093,26285,26153,26341,25961,25928,26180,26193,26370,26359,26235,26300,26153,26142,/all'); //window.open('/map.php?type=2&schools=26341,25961,25928,26180,26097,26193,26370,26239,26359,26093,26285,26153,26341,25961,25928,26180,26193,26370,26359,26235,26300,26153,26142,&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; }