function addMarkers() { mySelect = document.getElementById('selection'); Burkettsville = [];Celina = [];Coldwater = [];Fort_Recovery = [];Maria_Stein = [];Rockford = [];Mendon = [];Saint_Henry = [];mySelect.options[mySelect.options.length] = new Option("Burkettsville schools",'all=Burkettsville'); mySelect.options[mySelect.options.length] = new Option("Celina schools",'all=Celina'); mySelect.options[mySelect.options.length] = new Option("Coldwater schools",'all=Coldwater'); mySelect.options[mySelect.options.length] = new Option("Fort Recovery schools",'all=Fort_Recovery'); mySelect.options[mySelect.options.length] = new Option("Maria Stein schools",'all=Maria_Stein'); mySelect.options[mySelect.options.length] = new Option("Mendon schools",'all=Mendon'); mySelect.options[mySelect.options.length] = new Option("Rockford schools",'all=Rockford'); mySelect.options[mySelect.options.length] = new Option("Saint Henry schools",'all=Saint_Henry'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Burkettsville[Burkettsville.length] = createMarker(new GPoint(-84.64579773,40.35193634),"
Burkettsville Elementary School
71 W Main St
Burkettsville, OH 45310

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Burkettsville Elementary School",'Burkettsville=' + Burkettsville.length); Celina[Celina.length] = createMarker(new GPoint(-84.55785370,40.55491257),"
Celina High School
715 E Wayne St
Celina, OH 45822

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Celina High School",'Celina=' + Celina.length); Celina[Celina.length] = createMarker(new GPoint(-84.58557892,40.54849243),"
Celina Intermediate Elementary School
227 Portland St
Celina, OH 45822

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Celina Intermediate Elementary School",'Celina=' + Celina.length); Celina[Celina.length] = createMarker(new GPoint(-84.55976868,40.55510712),"
Celina Middle School
615 Holly St
Celina, OH 45822

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Celina Middle School",'Celina=' + Celina.length); Coldwater[Coldwater.length] = createMarker(new GPoint(-84.62887573,40.48223877),"
Coldwater Elementary School
310 N 2nd St
Coldwater, OH 45828

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Coldwater Elementary School",'Coldwater=' + Coldwater.length); Coldwater[Coldwater.length] = createMarker(new GPoint(-84.62887573,40.48223877),"
Coldwater High School
310 N 2nd St
Coldwater, OH 45828

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Coldwater High School",'Coldwater=' + Coldwater.length); Coldwater[Coldwater.length] = createMarker(new GPoint(-84.62887573,40.48223877),"
Coldwater Junior High School
310 N 2nd St
Coldwater, OH 45828

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Coldwater Junior High School",'Coldwater=' + Coldwater.length); Celina[Celina.length] = createMarker(new GPoint(-84.56053925,40.55313873),"
East Elementary School
615 E Wayne St
Celina, OH 45822

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("East Elementary School",'Celina=' + Celina.length); Celina[Celina.length] = createMarker(new GPoint(-84.56228500,40.55021100),"
Education Complex
585 E Livingston St
Celina, OH 45822

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Education Complex",'Celina=' + Celina.length); Fort_Recovery[Fort_Recovery.length] = createMarker(new GPoint(-84.77285004,40.40666580),"
Fort Recovery Elementary School
865 Sharpsburg Rd
Fort Recovery, OH 45846

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Fort Recovery Elementary School",'Fort_Recovery=' + Fort_Recovery.length); Fort_Recovery[Fort_Recovery.length] = createMarker(new GPoint(-84.76650238,40.40930176),"
Fort Recovery High School
Po Box 604
Fort Recovery, OH 45846

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Fort Recovery High School",'Fort_Recovery=' + Fort_Recovery.length); Fort_Recovery[Fort_Recovery.length] = createMarker(new GPoint(-84.77285004,40.40666580),"
Fort Recovery Middle School
865 Sharpsburg Rd
Fort Recovery, OH 45846

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Fort Recovery Middle School",'Fort_Recovery=' + Fort_Recovery.length); Celina[Celina.length] = createMarker(new GPoint(-84.54107666,40.48917389),"
Franklin Elementary School
6731 State Route 219
Celina, OH 45822

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Franklin Elementary School",'Celina=' + Celina.length); Maria_Stein[Maria_Stein.length] = createMarker(new GPoint(-84.49831390,40.40747452),"
Marion Local Elementary School
7956 State Route 119
Maria Stein, OH 45860

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Marion Local Elementary School",'Maria_Stein=' + Maria_Stein.length); Maria_Stein[Maria_Stein.length] = createMarker(new GPoint(-84.49367523,40.40477753),"
Marion Local High School
1901 State Route 716
Maria Stein, OH 45860

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Marion Local High School",'Maria_Stein=' + Maria_Stein.length); Celina[Celina.length] = createMarker(new GPoint(-84.56540600,40.54905800),"
Mercer Co Alternative School High School
441 E Market St
Celina, OH 45822

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mercer Co Alternative School High School",'Celina=' + Celina.length); Rockford[Rockford.length] = createMarker(new GPoint(-84.64799500,40.68856430),"
Parkway Elementary School
401 S Franklin St
Rockford, OH 45882

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Parkway Elementary School",'Rockford=' + Rockford.length); Rockford[Rockford.length] = createMarker(new GPoint(-84.64799500,40.68856430),"
Parkway High School
401 S Franklin St
Rockford, OH 45882

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Parkway High School",'Rockford=' + Rockford.length); Mendon[Mendon.length] = createMarker(new GPoint(-84.52390289,40.67129898),"
Parkway Intermediate Elementary School
300 E Jefferson St
Mendon, OH 45862

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Parkway Intermediate Elementary School",'Mendon=' + Mendon.length); Saint_Henry[Saint_Henry.length] = createMarker(new GPoint(-84.63811493,40.41603851),"
St Henry Elementary School
251 E Columbus St
Saint Henry, OH 45883

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("St Henry Elementary School",'Saint_Henry=' + Saint_Henry.length); Saint_Henry[Saint_Henry.length] = createMarker(new GPoint(-84.63548279,40.41603851),"
St Henry High School
391 E Columbus St
Saint Henry, OH 45883

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Henry High School",'Saint_Henry=' + Saint_Henry.length); Saint_Henry[Saint_Henry.length] = createMarker(new GPoint(-84.63562012,40.41603851),"
St Henry Middle School
381 E Columbus St
Saint Henry, OH 45883

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("St Henry Middle School",'Saint_Henry=' + Saint_Henry.length); Celina[Celina.length] = createMarker(new GPoint(-84.58850861,40.54563522),"
West Elementary School
1225 W Logan St
Celina, OH 45822

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("West Elementary School",'Celina=' + Celina.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(Burkettsville); map.removeOverlays(Celina); map.removeOverlays(Coldwater); map.removeOverlays(Fort_Recovery); map.removeOverlays(Maria_Stein); map.removeOverlays(Mendon); map.removeOverlays(Rockford); map.removeOverlays(Saint_Henry); 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(Burkettsville);map.removeOverlays(Burkettsville); map.removeOverlays(Celina); map.removeOverlays(Coldwater); map.removeOverlays(Fort_Recovery); map.removeOverlays(Maria_Stein); map.removeOverlays(Mendon); map.removeOverlays(Rockford); map.removeOverlays(Saint_Henry); map.addOverlays(Burkettsville); centerByArray(Burkettsville, false, false); cntMarker += Burkettsville.length; map.addOverlays(Celina); centerByArray(Celina, false, false); cntMarker += Celina.length; map.addOverlays(Coldwater); centerByArray(Coldwater, false, false); cntMarker += Coldwater.length; map.addOverlays(Fort_Recovery); centerByArray(Fort_Recovery, false, false); cntMarker += Fort_Recovery.length; map.addOverlays(Maria_Stein); centerByArray(Maria_Stein, false, false); cntMarker += Maria_Stein.length; map.addOverlays(Mendon); centerByArray(Mendon, false, false); cntMarker += Mendon.length; map.addOverlays(Rockford); centerByArray(Rockford, false, false); cntMarker += Rockford.length; map.addOverlays(Saint_Henry); centerByArray(Saint_Henry, false, false); cntMarker += Saint_Henry.length; centerByArray(Burkettsville,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'); } }