function addMarkers() { mySelect = document.getElementById('selection'); Cleveland = [];Charleston = [];mySelect.options[mySelect.options.length] = new Option("Charleston schools",'all=Charleston'); mySelect.options[mySelect.options.length] = new Option("Cleveland schools",'all=Cleveland'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Cleveland[Cleveland.length] = createMarker(new GPoint(-84.87634277,35.16025162),"
Arnold Elementary School
473 8th N W St
Cleveland, TN 37311

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Arnold Elementary School",'Cleveland=' + Cleveland.length); Cleveland[Cleveland.length] = createMarker(new GPoint(-84.87634277,35.16025162),"
Black Fox Elementary School
3119 S W Varnell Rd
Cleveland, TN 37311

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Black Fox Elementary School",'Cleveland=' + Cleveland.length); Cleveland[Cleveland.length] = createMarker(new GPoint(-84.90978241,35.09093475),"
Blue Springs Elementary School
4832 Blue Springs Rd
Cleveland, TN 37311

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Blue Springs Elementary School",'Cleveland=' + Cleveland.length); Cleveland[Cleveland.length] = createMarker(new GPoint(-84.87634277,35.16025162),"
Blythe- Bower Elementary School
604 20th S E St
Cleveland, TN 37311

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Blythe- Bower Elementary School",'Cleveland=' + Cleveland.length); Cleveland[Cleveland.length] = createMarker(new GPoint(-84.88957214,35.15602493),"
Bradley High School
1000 South Lee Highway
Cleveland, TN 37311

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bradley High School",'Cleveland=' + Cleveland.length); Charleston[Charleston.length] = createMarker(new GPoint(-84.76460266,35.27740097),"
Charleston Elementary School
P O Box 435
Charleston, TN 37310

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Charleston Elementary School",'Charleston=' + Charleston.length); Cleveland[Cleveland.length] = createMarker(new GPoint(-84.86759186,35.19314957),"
Cleveland High School
850 Raider Dr
Cleveland, TN 37312

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Cleveland High School",'Cleveland=' + Cleveland.length); Cleveland[Cleveland.length] = createMarker(new GPoint(-84.88898468,35.20353317),"
Cleveland Middle School
3635 Georgetown Road, N. W.
Cleveland, TN 37312

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Cleveland Middle School",'Cleveland=' + Cleveland.length); Cleveland[Cleveland.length] = createMarker(new GPoint(-84.85544586,35.20462799),"
Donald P Yates Primary
750 Mouse Creek Nw Rd
Cleveland, TN 37323

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Donald P Yates Primary",'Cleveland=' + Cleveland.length); Cleveland[Cleveland.length] = createMarker(new GPoint(-84.85818481,35.20956421),"
Ernest L Ross Elementary School
4340 Mouse Creek Rd
Cleveland, TN 37312

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Ernest L Ross Elementary School",'Cleveland=' + Cleveland.length); Cleveland[Cleveland.length] = createMarker(new GPoint(-84.87634277,35.16025162),"
George R Stuart Elementary School
802 20th Nw St
Cleveland, TN 37311

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("George R Stuart Elementary School",'Cleveland=' + Cleveland.length); Cleveland[Cleveland.length] = createMarker(new GPoint(-84.87634277,35.16025162),"
Hopewell Elementary School
5350 Freewill Nw Rd
Cleveland, TN 37312

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hopewell Elementary School",'Cleveland=' + Cleveland.length); Cleveland[Cleveland.length] = createMarker(new GPoint(-84.84485626,35.10319519),"
Lake Forest Middle School
610 Kile Lake Se Rd
Cleveland, TN 37323

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Lake Forest Middle School",'Cleveland=' + Cleveland.length); Cleveland[Cleveland.length] = createMarker(new GPoint(-84.86810303,35.16488266),"
Mayfield Elementary School
1201 Magnolia Avenue
Cleveland, TN 37311

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mayfield Elementary School",'Cleveland=' + Cleveland.length); Cleveland[Cleveland.length] = createMarker(new GPoint(-84.87634277,35.16025162),"
Michigan Avenue Elementary School
188 Michigan Ne Rd
Cleveland, TN 37312

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Michigan Avenue Elementary School",'Cleveland=' + Cleveland.length); Cleveland[Cleveland.length] = createMarker(new GPoint(-84.86206818,35.18474579),"
North Cleveland Horizon
209 Sunset Dr
Cleveland, TN 37312

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("North Cleveland Horizon",'Cleveland=' + Cleveland.length); Cleveland[Cleveland.length] = createMarker(new GPoint(-84.84182739,35.20777130),"
North Lee Elementary School
205 Sequoia Rd
Cleveland, TN 37312

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("North Lee Elementary School",'Cleveland=' + Cleveland.length); Cleveland[Cleveland.length] = createMarker(new GPoint(-84.83477783,35.15555954),"
Oak Grove Elementary School
400 S E Durkee Rd
Cleveland, TN 37323

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Oak Grove Elementary School",'Cleveland=' + Cleveland.length); Cleveland[Cleveland.length] = createMarker(new GPoint(-84.86831665,35.17435837),"
Ocoee Middle School
2250 N Ocoee St
Cleveland, TN 37311

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Ocoee Middle School",'Cleveland=' + Cleveland.length); Cleveland[Cleveland.length] = createMarker(new GPoint(-84.91793060,35.17805481),"
Prospect Elementary School
2450 N W Prospect School Rd
Cleveland, TN 37312

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Prospect Elementary School",'Cleveland=' + Cleveland.length); Cleveland[Cleveland.length] = createMarker(new GPoint(-84.87605200,35.20424300),"
Reach Adult High School
3535 Adkisson Drive N.w.
Cleveland, TN 37320

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Reach Adult High School",'Cleveland=' + Cleveland.length); Cleveland[Cleveland.length] = createMarker(new GPoint(-84.87634277,35.16025162),"
Taylors Elementary School
5265 S E Bates Pk
Cleveland, TN 37323

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Taylors Elementary School",'Cleveland=' + Cleveland.length); Cleveland[Cleveland.length] = createMarker(new GPoint(-84.80621338,35.05118561),"
Valley View Elementary School
5607 S E Spring Place Rd
Cleveland, TN 37323

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Valley View Elementary School",'Cleveland=' + Cleveland.length); Cleveland[Cleveland.length] = createMarker(new GPoint(-84.78710175,35.27497864),"
Walker Valley High School
750 Lauderdale Memorial Hwy. N
Cleveland, TN 37312

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Walker Valley High School",'Cleveland=' + Cleveland.length); Cleveland[Cleveland.length] = createMarker(new GPoint(-84.87306213,35.10102081),"
Waterville Elementary School
4081 Dalton Pike S. E.
Cleveland, TN 37323

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Waterville Elementary School",'Cleveland=' + Cleveland.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(Charleston); map.removeOverlays(Cleveland); 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(Cleveland);map.removeOverlays(Charleston); map.removeOverlays(Cleveland); map.addOverlays(Charleston); centerByArray(Charleston, false, false); cntMarker += Charleston.length; map.addOverlays(Cleveland); centerByArray(Cleveland, false, false); cntMarker += Cleveland.length; centerByArray(Cleveland,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'); } }