function addMarkers() { mySelect = document.getElementById('selection'); Ashland = [];Sullivan = [];Loudonville = [];Hayesville = [];Jeromesville = [];Perrysville = [];Nova = [];Nankin = [];Polk = [];mySelect.options[mySelect.options.length] = new Option("Ashland schools",'all=Ashland'); mySelect.options[mySelect.options.length] = new Option("Hayesville schools",'all=Hayesville'); mySelect.options[mySelect.options.length] = new Option("Jeromesville schools",'all=Jeromesville'); mySelect.options[mySelect.options.length] = new Option("Loudonville schools",'all=Loudonville'); mySelect.options[mySelect.options.length] = new Option("Nankin schools",'all=Nankin'); mySelect.options[mySelect.options.length] = new Option("Nova schools",'all=Nova'); mySelect.options[mySelect.options.length] = new Option("Perrysville schools",'all=Perrysville'); mySelect.options[mySelect.options.length] = new Option("Polk schools",'all=Polk'); mySelect.options[mySelect.options.length] = new Option("Sullivan schools",'all=Sullivan'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Ashland[Ashland.length] = createMarker(new GPoint(-82.31137848,40.86689758),"
Alternative High School
416 Arthur St
Ashland, OH 44805

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Alternative High School",'Ashland=' + Ashland.length); Ashland[Ashland.length] = createMarker(new GPoint(-82.32253265,40.85459518),"
Ashland High School
1440 King Rd
Ashland, OH 44805

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Ashland High School",'Ashland=' + Ashland.length); Ashland[Ashland.length] = createMarker(new GPoint(-82.31792450,40.87047195),"
Ashland Middle School
345 Cottage St
Ashland, OH 44805

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Ashland Middle School",'Ashland=' + Ashland.length); Ashland[Ashland.length] = createMarker(new GPoint(-82.26915741,40.80353928),"
Ashland-w Holmes Career Center
1783 State Route 60
Ashland, OH 44805

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Ashland-w Holmes Career Center",'Ashland=' + Ashland.length); Sullivan[Sullivan.length] = createMarker(new GPoint(-82.22299957,41.03599930),"
Black River Education Center Elementary School
257 County Road 40
Sullivan, OH 44880

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Black River Education Center Elementary School",'Sullivan=' + Sullivan.length); Sullivan[Sullivan.length] = createMarker(new GPoint(-82.17797852,41.05816269),"
Black River Education Center Middle School
257 County Road 40
Sullivan, OH 44880

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Black River Education Center Middle School",'Sullivan=' + Sullivan.length); Sullivan[Sullivan.length] = createMarker(new GPoint(-82.17510986,41.05816269),"
Black River High School
233 County Road 40
Sullivan, OH 44880

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Black River High School",'Sullivan=' + Sullivan.length); Loudonville[Loudonville.length] = createMarker(new GPoint(-82.23152161,40.63536453),"
Budd Elementary School
210 E Main St
Loudonville, OH 44842

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Budd Elementary School",'Loudonville=' + Loudonville.length); Ashland[Ashland.length] = createMarker(new GPoint(-82.36065674,40.88130569),"
Crestview Elementary School
1575 State Route 96
Ashland, OH 44805

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Crestview Elementary School",'Ashland=' + Ashland.length); Ashland[Ashland.length] = createMarker(new GPoint(-82.36065674,40.88130569),"
Crestview High School
1575 State Route 96
Ashland, OH 44805

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Crestview High School",'Ashland=' + Ashland.length); Ashland[Ashland.length] = createMarker(new GPoint(-82.36065674,40.88130569),"
Crestview Middle School
1575 State Route 96
Ashland, OH 44805

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Crestview Middle School",'Ashland=' + Ashland.length); Ashland[Ashland.length] = createMarker(new GPoint(-82.32848358,40.87915421),"
Edison Elementary School
1202 Masters Ave
Ashland, OH 44805

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Edison Elementary School",'Ashland=' + Ashland.length); Hayesville[Hayesville.length] = createMarker(new GPoint(-82.26602173,40.77310181),"
Hillsdale Elementary School
W Main St
Hayesville, OH 44838

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Hillsdale Elementary School",'Hayesville=' + Hayesville.length); Jeromesville[Jeromesville.length] = createMarker(new GPoint(-82.21053314,40.78436279),"
Hillsdale High School
485 Township Road 1902
Jeromesville, OH 44840

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Hillsdale High School",'Jeromesville=' + Jeromesville.length); Jeromesville[Jeromesville.length] = createMarker(new GPoint(-82.18679810,40.79700089),"
Hillsdale Middle School
Po Box 57
Jeromesville, OH 44840

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Hillsdale Middle School",'Jeromesville=' + Jeromesville.length); Ashland[Ashland.length] = createMarker(new GPoint(-82.31652832,40.87703705),"
Lincoln Elementary School
30 W 11th St
Ashland, OH 44805

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lincoln Elementary School",'Ashland=' + Ashland.length); Loudonville[Loudonville.length] = createMarker(new GPoint(-82.24141693,40.63842773),"
Loudonville High School
421 Campus Ave
Loudonville, OH 44842

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Loudonville High School",'Loudonville=' + Loudonville.length); Perrysville[Perrysville.length] = createMarker(new GPoint(-82.31829834,40.65890121),"
Louis Bromfield (mojcf) High School
1012 Odnr Mohican 51
Perrysville, OH 44864

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Louis Bromfield (mojcf) High School",'Perrysville=' + Perrysville.length); Ashland[Ashland.length] = createMarker(new GPoint(-82.31534400,40.86865000),"
Mapleton Elementary School
2 Mountie Dr
Ashland, OH 44805

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mapleton Elementary School",'Ashland=' + Ashland.length); Ashland[Ashland.length] = createMarker(new GPoint(-82.28177643,40.96624756),"
Mapleton High School
635 County Road 801
Ashland, OH 44805

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mapleton High School",'Ashland=' + Ashland.length); Nova[Nova.length] = createMarker(new GPoint(-82.33270264,41.02130127),"
Mapleton Middle School
Po Box 37
Nova, OH 44859

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Mapleton Middle School",'Nova=' + Nova.length); Loudonville[Loudonville.length] = createMarker(new GPoint(-82.23152161,40.63416290),"
Mcmullen Elementary School
224 E Bustle St
Loudonville, OH 44842

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mcmullen Elementary School",'Loudonville=' + Loudonville.length); Ashland[Ashland.length] = createMarker(new GPoint(-82.26176453,40.85722351),"
Montgomery Elementary School
725 Us Highway 250 E
Ashland, OH 44805

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Montgomery Elementary School",'Ashland=' + Ashland.length); Nankin[Nankin.length] = createMarker(new GPoint(-82.28189850,40.92129898),"
Nankin Elementary School
Po Box 209
Nankin, OH 44848

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Nankin Elementary School",'Nankin=' + Nankin.length); Ashland[Ashland.length] = createMarker(new GPoint(-82.30384827,40.86733246),"
Osborn Elementary School
544 E Main St
Ashland, OH 44805

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Osborn Elementary School",'Ashland=' + Ashland.length); Perrysville[Perrysville.length] = createMarker(new GPoint(-82.32559967,40.65850067),"
Perrysville Junior High School
Po Box 426
Perrysville, OH 44864

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Perrysville Junior High School",'Perrysville=' + Perrysville.length); Polk[Polk.length] = createMarker(new GPoint(-82.20639801,40.92860031),"
Polk Elementary School
Po Box 317
Polk, OH 44866

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Polk Elementary School",'Polk=' + Polk.length); Ashland[Ashland.length] = createMarker(new GPoint(-82.32843781,40.85786438),"
Taft Elementary School
825 Smith Rd
Ashland, OH 44805

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Taft Elementary School",'Ashland=' + Ashland.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(Ashland); map.removeOverlays(Hayesville); map.removeOverlays(Jeromesville); map.removeOverlays(Loudonville); map.removeOverlays(Nankin); map.removeOverlays(Nova); map.removeOverlays(Perrysville); map.removeOverlays(Polk); map.removeOverlays(Sullivan); 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(Ashland);map.removeOverlays(Ashland); map.removeOverlays(Hayesville); map.removeOverlays(Jeromesville); map.removeOverlays(Loudonville); map.removeOverlays(Nankin); map.removeOverlays(Nova); map.removeOverlays(Perrysville); map.removeOverlays(Polk); map.removeOverlays(Sullivan); map.addOverlays(Ashland); centerByArray(Ashland, false, false); cntMarker += Ashland.length; map.addOverlays(Hayesville); centerByArray(Hayesville, false, false); cntMarker += Hayesville.length; map.addOverlays(Jeromesville); centerByArray(Jeromesville, false, false); cntMarker += Jeromesville.length; map.addOverlays(Loudonville); centerByArray(Loudonville, false, false); cntMarker += Loudonville.length; map.addOverlays(Nankin); centerByArray(Nankin, false, false); cntMarker += Nankin.length; map.addOverlays(Nova); centerByArray(Nova, false, false); cntMarker += Nova.length; map.addOverlays(Perrysville); centerByArray(Perrysville, false, false); cntMarker += Perrysville.length; map.addOverlays(Polk); centerByArray(Polk, false, false); cntMarker += Polk.length; map.addOverlays(Sullivan); centerByArray(Sullivan, false, false); cntMarker += Sullivan.length; centerByArray(Ashland,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'); } }