function addMarkers() { mySelect = document.getElementById('selection'); Alcoa = [];Maryville = [];Friendsville = [];Louisville = [];Rockford = [];Townsend = [];Walland = [];mySelect.options[mySelect.options.length] = new Option("Alcoa schools",'all=Alcoa'); mySelect.options[mySelect.options.length] = new Option("Friendsville schools",'all=Friendsville'); mySelect.options[mySelect.options.length] = new Option("Louisville schools",'all=Louisville'); mySelect.options[mySelect.options.length] = new Option("Maryville schools",'all=Maryville'); mySelect.options[mySelect.options.length] = new Option("Rockford schools",'all=Rockford'); mySelect.options[mySelect.options.length] = new Option("Townsend schools",'all=Townsend'); mySelect.options[mySelect.options.length] = new Option("Walland schools",'all=Walland'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Alcoa[Alcoa.length] = createMarker(new GPoint(-83.97413635,35.78973007),"
Alcoa Elementary School
1200 Springbrook Rd
Alcoa, TN 37701

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Alcoa Elementary School",'Alcoa=' + Alcoa.length); Alcoa[Alcoa.length] = createMarker(new GPoint(-83.98039246,35.79277039),"
Alcoa High School
532 Faraday St
Alcoa, TN 37701

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Alcoa High School",'Alcoa=' + Alcoa.length); Alcoa[Alcoa.length] = createMarker(new GPoint(-83.97953033,35.79371262),"
Alcoa Middle School
1325 Springbrook Rd
Alcoa, TN 37701

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Alcoa Middle School",'Alcoa=' + Alcoa.length); Maryville[Maryville.length] = createMarker(new GPoint(-84.02932739,35.67642975),"
Carpenters Middle School
920 Huffstetler Rd
Maryville, TN 37801

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Carpenters Middle School",'Maryville=' + Maryville.length); Maryville[Maryville.length] = createMarker(new GPoint(-83.91147614,35.80676270),"
Eagleton Elementary School
708 Sam Houston School Rd
Maryville, TN 37804

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Eagleton Elementary School",'Maryville=' + Maryville.length); Maryville[Maryville.length] = createMarker(new GPoint(-83.94553375,35.79713821),"
Eagleton Middle School
2610 Cinema Dr
Maryville, TN 37804

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Eagleton Middle School",'Maryville=' + Maryville.length); Maryville[Maryville.length] = createMarker(new GPoint(-83.95616150,35.76759720),"
Everett Lrn Oppt Cnt
1500 Jett Rd
Maryville, TN 37804

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Everett Lrn Oppt Cnt",'Maryville=' + Maryville.length); Maryville[Maryville.length] = createMarker(new GPoint(-84.00465393,35.71879578),"
Fairview Elementary School
2130 Old Niles Ferry
Maryville, TN 37803

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Fairview Elementary School",'Maryville=' + Maryville.length); Maryville[Maryville.length] = createMarker(new GPoint(-83.98963165,35.72635269),"
Foothills Elementary School
520 Sandy Springs Rd
Maryville, TN 37803

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Foothills Elementary School",'Maryville=' + Maryville.length); Maryville[Maryville.length] = createMarker(new GPoint(-83.96411896,35.75721359),"
Fort Craig Elementary School
520 S Washington Avenue
Maryville, TN 37804

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Fort Craig Elementary School",'Maryville=' + Maryville.length); Friendsville[Friendsville.length] = createMarker(new GPoint(-84.13033295,35.76184845),"
Friendsville Elementary School
210 E 4th Av
Friendsville, TN 37737

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Friendsville Elementary School",'Friendsville=' + Friendsville.length); Maryville[Maryville.length] = createMarker(new GPoint(-83.86933899,35.75933456),"
Heritage High School
3741 E Lamar Alex Pkwy
Maryville, TN 37804

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Heritage High School",'Maryville=' + Maryville.length); Maryville[Maryville.length] = createMarker(new GPoint(-83.86958313,35.75931549),"
Heritage Middle School
3737 E Lamar Alex Pkwy
Maryville, TN 37804

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Heritage Middle School",'Maryville=' + Maryville.length); Maryville[Maryville.length] = createMarker(new GPoint(-83.93936157,35.76909256),"
John Sevier Elementary School
2001 Sequoyah Avenue
Maryville, TN 37804

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("John Sevier Elementary School",'Maryville=' + Maryville.length); Maryville[Maryville.length] = createMarker(new GPoint(-84.09595490,35.62263870),"
Lanier Elementary School
6006 Lanier Rd
Maryville, TN 37801

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lanier Elementary School",'Maryville=' + Maryville.length); Maryville[Maryville.length] = createMarker(new GPoint(-83.95616150,35.76759720),"
M Richardson Adult High School
1500 Jet Rd
Maryville, TN 37804

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("M Richardson Adult High School",'Maryville=' + Maryville.length); Maryville[Maryville.length] = createMarker(new GPoint(-84.03745270,35.74924850),"
Mary Blount Elementary School
131 South Old Glory Rd
Maryville, TN 37801

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mary Blount Elementary School",'Maryville=' + Maryville.length); Maryville[Maryville.length] = createMarker(new GPoint(-83.97810364,35.74747467),"
Maryville High School
825 Lawrence Av
Maryville, TN 37803

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Maryville High School",'Maryville=' + Maryville.length); Maryville[Maryville.length] = createMarker(new GPoint(-83.98503113,35.72598267),"
Maryville Intermediate School
835 Montgomery La
Maryville, TN 37803

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Maryville Intermediate School",'Maryville=' + Maryville.length); Maryville[Maryville.length] = createMarker(new GPoint(-83.97118378,35.74110413),"
Maryville Middle School
805 Montvale Sta Rd
Maryville, TN 37803

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Maryville Middle School",'Maryville=' + Maryville.length); Louisville[Louisville.length] = createMarker(new GPoint(-84.03377533,35.80390930),"
Middle Settlements Elementary School
3105 Miser Station Rd
Louisville, TN 37777

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Middle Settlements Elementary School",'Louisville=' + Louisville.length); Maryville[Maryville.length] = createMarker(new GPoint(-83.96683502,35.69530106),"
Montvale Elementary School
3128 Montvale Rd
Maryville, TN 37803

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Montvale Elementary School",'Maryville=' + Maryville.length); Maryville[Maryville.length] = createMarker(new GPoint(-83.87001801,35.80529404),"
Porter Elementary School
4520 Wildwood Springs Rd
Maryville, TN 37804

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Porter Elementary School",'Maryville=' + Maryville.length); Rockford[Rockford.length] = createMarker(new GPoint(-83.94284821,35.82465363),"
Rockford Elementary School
3728 Williams Mill Rd
Rockford, TN 37853

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Rockford Elementary School",'Rockford=' + Rockford.length); Maryville[Maryville.length] = createMarker(new GPoint(-83.97587585,35.74619675),"
Sam Houston Elementary School
330 Melrose St
Maryville, TN 37803

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Sam Houston Elementary School",'Maryville=' + Maryville.length); Townsend[Townsend.length] = createMarker(new GPoint(-83.75510406,35.67424774),"
Townsend Elementary School
P O Box 399
Townsend, TN 37882

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Townsend Elementary School",'Townsend=' + Townsend.length); Walland[Walland.length] = createMarker(new GPoint(-83.81165314,35.72950745),"
Walland Elementary School
247 E Millers Cove Rd
Walland, TN 37886

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Walland Elementary School",'Walland=' + Walland.length); Maryville[Maryville.length] = createMarker(new GPoint(-84.03533173,35.74403381),"
William Blount High School
219 County Farm Rd
Maryville, TN 37801

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("William Blount High School",'Maryville=' + Maryville.length); Maryville[Maryville.length] = createMarker(new GPoint(-84.03579712,35.73686981),"
William Blount Middle School
1126 William Blount Dr
Maryville, TN 37801

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("William Blount Middle School",'Maryville=' + Maryville.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,10); /* 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(Alcoa); map.removeOverlays(Friendsville); map.removeOverlays(Louisville); map.removeOverlays(Maryville); map.removeOverlays(Rockford); map.removeOverlays(Townsend); map.removeOverlays(Walland); 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(Alcoa);map.removeOverlays(Alcoa); map.removeOverlays(Friendsville); map.removeOverlays(Louisville); map.removeOverlays(Maryville); map.removeOverlays(Rockford); map.removeOverlays(Townsend); map.removeOverlays(Walland); map.addOverlays(Alcoa); centerByArray(Alcoa, false, false); cntMarker += Alcoa.length; map.addOverlays(Friendsville); centerByArray(Friendsville, false, false); cntMarker += Friendsville.length; map.addOverlays(Louisville); centerByArray(Louisville, false, false); cntMarker += Louisville.length; map.addOverlays(Maryville); centerByArray(Maryville, false, false); cntMarker += Maryville.length; map.addOverlays(Rockford); centerByArray(Rockford, false, false); cntMarker += Rockford.length; map.addOverlays(Townsend); centerByArray(Townsend, false, false); cntMarker += Townsend.length; map.addOverlays(Walland); centerByArray(Walland, false, false); cntMarker += Walland.length; centerByArray(Alcoa,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'); } }