function addMarkers() { mySelect = document.getElementById('selection'); Plain = [];London = [];West_Jefferson = [];Plain_City = [];Sedalia = [];Mount_Sterling = [];mySelect.options[mySelect.options.length] = new Option("London schools",'all=London'); mySelect.options[mySelect.options.length] = new Option("Mount Sterling schools",'all=Mount_Sterling'); mySelect.options[mySelect.options.length] = new Option("Plain schools",'all=Plain'); mySelect.options[mySelect.options.length] = new Option("Plain City schools",'all=Plain_City'); mySelect.options[mySelect.options.length] = new Option("Sedalia schools",'all=Sedalia'); mySelect.options[mySelect.options.length] = new Option("West Jefferson schools",'all=West_Jefferson'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Plain[Plain.length] = createMarker(new GPoint(-83.18726400,40.11446300),"
Canaan Middle School
7055 Us Highway 42 S
Plain, OH 43064

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Canaan Middle School",'Plain=' + Plain.length); London[London.length] = createMarker(new GPoint(-83.28553772,39.85877228),"
Fairfield Elementary School
5681 W Jefferson Kiousville Rd
London, OH 43140

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Fairfield Elementary School",'London=' + London.length); West_Jefferson[West_Jefferson.length] = createMarker(new GPoint(-83.27172089,39.94192123),"
Frey Elementary School
899 Norwood Dr
West Jefferson, OH 43162

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Frey Elementary School",'West_Jefferson=' + West_Jefferson.length); Plain_City[Plain_City.length] = createMarker(new GPoint(-83.29646301,40.04547501),"
H E Tolles Technical Center
7877 Us Highway 42 N
Plain City, OH 43064

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("H E Tolles Technical Center",'Plain_City=' + Plain_City.length); West_Jefferson[West_Jefferson.length] = createMarker(new GPoint(-83.27172089,39.94192123),"
Jefferson Memorial Middle School
177 S Frey Ave
West Jefferson, OH 43162

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Jefferson Memorial Middle School",'West_Jefferson=' + West_Jefferson.length); Plain_City[Plain_City.length] = createMarker(new GPoint(-83.33302307,40.06287384),"
Jonathan Alder High School
9200 Us Route 42 S
Plain City, OH 43064

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Jonathan Alder High School",'Plain_City=' + Plain_City.length); Plain_City[Plain_City.length] = createMarker(new GPoint(-83.26782300,40.10797300),"
Jonathan Alder Junior High School
6440 Kilbury Huber Rd
Plain City, OH 43064

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Jonathan Alder Junior High School",'Plain_City=' + Plain_City.length); London[London.length] = createMarker(new GPoint(-83.40684509,39.93769455),"
London Deercreek Elementary School
1740 Cumberland Ne
London, OH 43140

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("London Deercreek Elementary School",'London=' + London.length); London[London.length] = createMarker(new GPoint(-83.44572449,39.88722229),"
London Digital Academy
60 S Walnut St
London, OH 43140

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("London Digital Academy",'London=' + London.length); London[London.length] = createMarker(new GPoint(-83.44534302,39.88592148),"
London Elementary School
380 Elm St
London, OH 43140

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("London Elementary School",'London=' + London.length); London[London.length] = createMarker(new GPoint(-83.44805145,39.90095520),"
London High School
336 Elm St
London, OH 43140

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("London High School",'London=' + London.length); London[London.length] = createMarker(new GPoint(-83.44577026,39.88696289),"
London Middle School
60 S Walnut St
London, OH 43140

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("London Middle School",'London=' + London.length); London[London.length] = createMarker(new GPoint(-83.44635773,39.88745499),"
London Primary Elementary School
20 S Walnut St
London, OH 43140

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("London Primary Elementary School",'London=' + London.length); London[London.length] = createMarker(new GPoint(-83.45015717,39.88772583),"
London Somerford Pri Elementary School
91 State Route 56 Nw
London, OH 43140

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("London Somerford Pri Elementary School",'London=' + London.length); London[London.length] = createMarker(new GPoint(-83.45130157,39.84817886),"
Madison Rural Elementary School
375 Old Xenia Rd Se
London, OH 43140

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Madison Rural Elementary School",'London=' + London.length); London[London.length] = createMarker(new GPoint(-83.48706055,39.79007339),"
Madison-plains High School
800 Linson Rd
London, OH 43140

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Madison-plains High School",'London=' + London.length); London[London.length] = createMarker(new GPoint(-83.47496033,39.78744888),"
Madison-plains Middle School
9940 State Route 38 Sw
London, OH 43140

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Madison-plains Middle School",'London=' + London.length); Sedalia[Sedalia.length] = createMarker(new GPoint(-83.46478271,39.85535812),"
Midway Elementary School
13880 State Route 38
Sedalia, OH 43151

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Midway Elementary School",'Sedalia=' + Sedalia.length); London[London.length] = createMarker(new GPoint(-83.41698456,40.00919342),"
Monroe Elementary School
5000 State Route 38 Nw
London, OH 43140

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Monroe Elementary School",'London=' + London.length); Mount_Sterling[Mount_Sterling.length] = createMarker(new GPoint(-83.26773834,39.71894455),"
Mt Sterling Elementary School
94 W Main St
Mount Sterling, OH 43143

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mt Sterling Elementary School",'Mount_Sterling=' + Mount_Sterling.length); Plain_City[Plain_City.length] = createMarker(new GPoint(-83.27082825,40.10866928),"
Plain City Elementary School
340 W Main St
Plain City, OH 43064

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Plain City Elementary School",'Plain_City=' + Plain_City.length); West_Jefferson[West_Jefferson.length] = createMarker(new GPoint(-83.28981781,39.94386673),"
West Jefferson Digital Academy
906 W Main St
West Jefferson, OH 43162

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("West Jefferson Digital Academy",'West_Jefferson=' + West_Jefferson.length); West_Jefferson[West_Jefferson.length] = createMarker(new GPoint(-83.27829742,39.93500137),"
West Jefferson High School
1 Roughrider Dr
West Jefferson, OH 43162

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("West Jefferson High School",'West_Jefferson=' + West_Jefferson.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(London); map.removeOverlays(Mount_Sterling); map.removeOverlays(Plain); map.removeOverlays(Plain_City); map.removeOverlays(Sedalia); map.removeOverlays(West_Jefferson); 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(Plain);map.removeOverlays(London); map.removeOverlays(Mount_Sterling); map.removeOverlays(Plain); map.removeOverlays(Plain_City); map.removeOverlays(Sedalia); map.removeOverlays(West_Jefferson); map.addOverlays(London); centerByArray(London, false, false); cntMarker += London.length; map.addOverlays(Mount_Sterling); centerByArray(Mount_Sterling, false, false); cntMarker += Mount_Sterling.length; map.addOverlays(Plain); centerByArray(Plain, false, false); cntMarker += Plain.length; map.addOverlays(Plain_City); centerByArray(Plain_City, false, false); cntMarker += Plain_City.length; map.addOverlays(Sedalia); centerByArray(Sedalia, false, false); cntMarker += Sedalia.length; map.addOverlays(West_Jefferson); centerByArray(West_Jefferson, false, false); cntMarker += West_Jefferson.length; centerByArray(Plain,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'); } }