function addMarkers() { mySelect = document.getElementById('selection'); Byesville = [];Lore_City = [];Senecaville = [];Cambridge = [];Quaker_City = [];mySelect.options[mySelect.options.length] = new Option("Byesville schools",'all=Byesville'); mySelect.options[mySelect.options.length] = new Option("Cambridge schools",'all=Cambridge'); mySelect.options[mySelect.options.length] = new Option("Lore City schools",'all=Lore_City'); mySelect.options[mySelect.options.length] = new Option("Quaker City schools",'all=Quaker_City'); mySelect.options[mySelect.options.length] = new Option("Senecaville schools",'all=Senecaville'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Byesville[Byesville.length] = createMarker(new GPoint(-81.55680084,39.95451355),"
Brook Elementary School
58601 Marietta Rd
Byesville, OH 43723

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Brook Elementary School",'Byesville=' + Byesville.length); Lore_City[Lore_City.length] = createMarker(new GPoint(-81.45924600,39.98609600),"
Buckeye Trail Elementary School
19153 Cadiz Rd
Lore City, OH 43755

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Buckeye Trail Elementary School",'Lore_City=' + Lore_City.length); Lore_City[Lore_City.length] = createMarker(new GPoint(-81.44416046,40.05290985),"
Buckeye Trail High School
65555 Wintergreen Rd
Lore City, OH 43755

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Buckeye Trail High School",'Lore_City=' + Lore_City.length); Senecaville[Senecaville.length] = createMarker(new GPoint(-81.52364349,39.92591476),"
Buffalo Campus High School
57090 Vocational Rd
Senecaville, OH 43780

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Buffalo Campus High School",'Senecaville=' + Senecaville.length); Byesville[Byesville.length] = createMarker(new GPoint(-81.53507996,39.97023773),"
Byesville Elementary School
212 Main St
Byesville, OH 43723

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Byesville Elementary School",'Byesville=' + Byesville.length); Cambridge[Cambridge.length] = createMarker(new GPoint(-81.58318329,40.04833221),"
Cambridge High School
65328 Creek Rd
Cambridge, OH 43725

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Cambridge High School",'Cambridge=' + Cambridge.length); Cambridge[Cambridge.length] = createMarker(new GPoint(-81.58544922,40.05109024),"
Cambridge Middle School
65370 Creek Rd
Cambridge, OH 43725

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Cambridge Middle School",'Cambridge=' + Cambridge.length); Cambridge[Cambridge.length] = createMarker(new GPoint(-81.58419037,40.03483582),"
Central Elementary School
1115 Clairmont Ave
Cambridge, OH 43725

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Central Elementary School",'Cambridge=' + Cambridge.length); Cambridge[Cambridge.length] = createMarker(new GPoint(-81.59220123,40.01862335),"
Garfield Elementary School
605 S 7th St
Cambridge, OH 43725

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Garfield Elementary School",'Cambridge=' + Cambridge.length); Cambridge[Cambridge.length] = createMarker(new GPoint(-81.55767059,40.12599182),"
Liberty Elementary School
9259 Liberty School Rd
Cambridge, OH 43725

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Liberty Elementary School",'Cambridge=' + Cambridge.length); Cambridge[Cambridge.length] = createMarker(new GPoint(-81.59658813,40.03348923),"
Lincoln Elementary School
850 N 4th St
Cambridge, OH 43725

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lincoln Elementary School",'Cambridge=' + Cambridge.length); Lore_City[Lore_City.length] = createMarker(new GPoint(-81.37777710,40.10564041),"
Madison Elementary School
65553 Wintergreen Rd
Lore City, OH 43755

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Madison Elementary School",'Lore_City=' + Lore_City.length); Byesville[Byesville.length] = createMarker(new GPoint(-81.55672455,39.95455170),"
Meadowbrook High School
58615 Marietta Rd
Byesville, OH 43723

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Meadowbrook High School",'Byesville=' + Byesville.length); Byesville[Byesville.length] = createMarker(new GPoint(-81.55677032,39.95452881),"
Meadowbrook Middle School
58607 Marietta Rd
Byesville, OH 43723

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Meadowbrook Middle School",'Byesville=' + Byesville.length); Cambridge[Cambridge.length] = createMarker(new GPoint(-81.58636475,40.05250168),"
North Elementary School
65424 Creek Rd
Cambridge, OH 43725

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("North Elementary School",'Cambridge=' + Cambridge.length); Cambridge[Cambridge.length] = createMarker(new GPoint(-81.58216858,40.03469086),"
Oakland Elementary School
1300 Clairmont Ave
Cambridge, OH 43725

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Oakland Elementary School",'Cambridge=' + Cambridge.length); Lore_City[Lore_City.length] = createMarker(new GPoint(-81.44170380,40.03770065),"
Old Washington Elementary School
65553 Wintergreen Rd
Lore City, OH 43755

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Old Washington Elementary School",'Lore_City=' + Lore_City.length); Cambridge[Cambridge.length] = createMarker(new GPoint(-81.58359528,40.02481079),"
Park Elementary School
150 Highland Ave
Cambridge, OH 43725

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Park Elementary School",'Cambridge=' + Cambridge.length); Cambridge[Cambridge.length] = createMarker(new GPoint(-81.66068268,40.01401901),"
Pike Elementary School
4533 Peters Creek Rd
Cambridge, OH 43725

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Pike Elementary School",'Cambridge=' + Cambridge.length); Quaker_City[Quaker_City.length] = createMarker(new GPoint(-81.23023224,40.05603409),"
Quaker Elementary School
200 Fair St
Quaker City, OH 43773

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Quaker Elementary School",'Quaker_City=' + Quaker_City.length); Senecaville[Senecaville.length] = createMarker(new GPoint(-81.46017456,39.95183563),"
Secrest Elementary School
58860 Wintergreen Rd
Senecaville, OH 43780

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Secrest Elementary School",'Senecaville=' + Senecaville.length); Cambridge[Cambridge.length] = createMarker(new GPoint(-81.59098053,40.01961136),"
South Elementary School
518 S 8th St
Cambridge, OH 43725

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("South Elementary School",'Cambridge=' + Cambridge.length); Cambridge[Cambridge.length] = createMarker(new GPoint(-81.58762360,40.03104019),"
Washington Elementary School
916 Foster Ave
Cambridge, OH 43725

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