function addMarkers() { mySelect = document.getElementById('selection'); Coshocton = [];Conesville = [];Fresno = [];Keene = [];Plainfield = [];West_Lafayette = [];Warsaw = [];mySelect.options[mySelect.options.length] = new Option("Conesville schools",'all=Conesville'); mySelect.options[mySelect.options.length] = new Option("Coshocton schools",'all=Coshocton'); mySelect.options[mySelect.options.length] = new Option("Fresno schools",'all=Fresno'); mySelect.options[mySelect.options.length] = new Option("Keene schools",'all=Keene'); mySelect.options[mySelect.options.length] = new Option("Plainfield schools",'all=Plainfield'); mySelect.options[mySelect.options.length] = new Option("Warsaw schools",'all=Warsaw'); mySelect.options[mySelect.options.length] = new Option("West Lafayette schools",'all=West_Lafayette'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Coshocton[Coshocton.length] = createMarker(new GPoint(-81.85925293,40.27201462),"
Central Elementary School
724 Walnut St
Coshocton, OH 43812

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Central Elementary School",'Coshocton=' + Coshocton.length); Conesville[Conesville.length] = createMarker(new GPoint(-81.89363098,40.18796539),"
Conesville Elementary School
199 State St
Conesville, OH 43811

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Conesville Elementary School",'Conesville=' + Conesville.length); Coshocton[Coshocton.length] = createMarker(new GPoint(-81.85955048,40.27204895),"
Coshocton County Career Center
23640 Airport Rd
Coshocton, OH 43812

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Coshocton County Career Center",'Coshocton=' + Coshocton.length); Coshocton[Coshocton.length] = createMarker(new GPoint(-81.84493256,40.26120758),"
Coshocton High School
1205 Cambridge Rd
Coshocton, OH 43812

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Coshocton High School",'Coshocton=' + Coshocton.length); Coshocton[Coshocton.length] = createMarker(new GPoint(-81.84343700,40.25922500),"
Coshocton Opportunity School
1207 Cambridge Rd
Coshocton, OH 43812

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Coshocton Opportunity School",'Coshocton=' + Coshocton.length); Fresno[Fresno.length] = createMarker(new GPoint(-81.74182129,40.33221817),"
Fresno Elementary School
26366 County Road 171
Fresno, OH 43824

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Fresno Elementary School",'Fresno=' + Fresno.length); Keene[Keene.length] = createMarker(new GPoint(-81.86830139,40.34500122),"
Keene Elementary School
Po Box 652
Keene, OH 43828

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Keene Elementary School",'Keene=' + Keene.length); Coshocton[Coshocton.length] = createMarker(new GPoint(-81.84808350,40.26596832),"
Lincoln Elementary School
801 Cambridge Rd
Coshocton, OH 43812

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lincoln Elementary School",'Coshocton=' + Coshocton.length); Plainfield[Plainfield.length] = createMarker(new GPoint(-81.73239899,40.20190048),"
Plainfield Elementary School
Po Box 448
Plainfield, OH 43836

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Plainfield Elementary School",'Plainfield=' + Plainfield.length); Coshocton[Coshocton.length] = createMarker(new GPoint(-81.85364532,40.24616623),"
Pleasant Valley
1160 Cassingham Hollow Dr
Coshocton, OH 43812

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Pleasant Valley",'Coshocton=' + Coshocton.length); West_Lafayette[West_Lafayette.length] = createMarker(new GPoint(-81.75817108,40.27197647),"
Ridgewood High School
602 Johnson St
West Lafayette, OH 43845

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Ridgewood High School",'West_Lafayette=' + West_Lafayette.length); West_Lafayette[West_Lafayette.length] = createMarker(new GPoint(-81.75357819,40.27092361),"
Ridgewood Middle School
517 S Oak St
West Lafayette, OH 43845

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Ridgewood Middle School",'West_Lafayette=' + West_Lafayette.length); Warsaw[Warsaw.length] = createMarker(new GPoint(-81.96044922,40.34019089),"
River View High School
26496 State Route 60
Warsaw, OH 43844

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("River View High School",'Warsaw=' + Warsaw.length); Warsaw[Warsaw.length] = createMarker(new GPoint(-81.96036530,40.34109879),"
River View Junior High School
26546 State Route 60
Warsaw, OH 43844

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("River View Junior High School",'Warsaw=' + Warsaw.length); Coshocton[Coshocton.length] = createMarker(new GPoint(-81.86135864,40.26626968),"
South Lawn Elementary School
753 S Lawn Ave
Coshocton, OH 43812

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("South Lawn Elementary School",'Coshocton=' + Coshocton.length); Warsaw[Warsaw.length] = createMarker(new GPoint(-82.12802887,40.24496078),"
Union Elementary School
19781 State Route 79
Warsaw, OH 43844

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Union Elementary School",'Warsaw=' + Warsaw.length); Warsaw[Warsaw.length] = createMarker(new GPoint(-82.04280090,40.33660126),"
Warsaw Elementary School
Po Box 97
Warsaw, OH 43844

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Warsaw Elementary School",'Warsaw=' + Warsaw.length); Coshocton[Coshocton.length] = createMarker(new GPoint(-81.84629059,40.27622604),"
Washington Elementary School
1517 Chestnut St
Coshocton, OH 43812

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Washington Elementary School",'Coshocton=' + Coshocton.length); West_Lafayette[West_Lafayette.length] = createMarker(new GPoint(-81.75379944,40.27383041),"
West Lafayette Elementary School
225 W Union Ave
West Lafayette, OH 43845

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("West Lafayette Elementary School",'West_Lafayette=' + West_Lafayette.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(Conesville); map.removeOverlays(Coshocton); map.removeOverlays(Fresno); map.removeOverlays(Keene); map.removeOverlays(Plainfield); map.removeOverlays(Warsaw); map.removeOverlays(West_Lafayette); 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(Coshocton);map.removeOverlays(Conesville); map.removeOverlays(Coshocton); map.removeOverlays(Fresno); map.removeOverlays(Keene); map.removeOverlays(Plainfield); map.removeOverlays(Warsaw); map.removeOverlays(West_Lafayette); map.addOverlays(Conesville); centerByArray(Conesville, false, false); cntMarker += Conesville.length; map.addOverlays(Coshocton); centerByArray(Coshocton, false, false); cntMarker += Coshocton.length; map.addOverlays(Fresno); centerByArray(Fresno, false, false); cntMarker += Fresno.length; map.addOverlays(Keene); centerByArray(Keene, false, false); cntMarker += Keene.length; map.addOverlays(Plainfield); centerByArray(Plainfield, false, false); cntMarker += Plainfield.length; map.addOverlays(Warsaw); centerByArray(Warsaw, false, false); cntMarker += Warsaw.length; map.addOverlays(West_Lafayette); centerByArray(West_Lafayette, false, false); cntMarker += West_Lafayette.length; centerByArray(Coshocton,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'); } }