function addMarkers() { mySelect = document.getElementById('selection'); Hillsboro = [];Leesburg = [];Greenfield = [];Lynchburg = [];Mowrystown = [];mySelect.options[mySelect.options.length] = new Option("Greenfield schools",'all=Greenfield'); mySelect.options[mySelect.options.length] = new Option("Hillsboro schools",'all=Hillsboro'); mySelect.options[mySelect.options.length] = new Option("Leesburg schools",'all=Leesburg'); mySelect.options[mySelect.options.length] = new Option("Lynchburg schools",'all=Lynchburg'); mySelect.options[mySelect.options.length] = new Option("Mowrystown schools",'all=Mowrystown'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Hillsboro[Hillsboro.length] = createMarker(new GPoint(-83.66207123,39.07023239),"
Bright Elementary School
6100 Fair Ridge Rd
Hillsboro, OH 45133

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Bright Elementary School",'Hillsboro=' + Hillsboro.length); Leesburg[Leesburg.length] = createMarker(new GPoint(-83.54353333,39.32761002),"
Fairfield Local Elementary School
11611 State Route 771
Leesburg, OH 45135

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Fairfield Local Elementary School",'Leesburg=' + Leesburg.length); Leesburg[Leesburg.length] = createMarker(new GPoint(-83.54353333,39.32761002),"
Fairfield Local High School
11611 State Route 771
Leesburg, OH 45135

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Fairfield Local High School",'Leesburg=' + Leesburg.length); Leesburg[Leesburg.length] = createMarker(new GPoint(-83.54353333,39.32761002),"
Fairfield Local Middle School
11611 State Route 771
Leesburg, OH 45135

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Fairfield Local Middle School",'Leesburg=' + Leesburg.length); Greenfield[Greenfield.length] = createMarker(new GPoint(-83.38751221,39.35190582),"
Greenfield Elementary School
200 N 5th St
Greenfield, OH 45123

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Greenfield Elementary School",'Greenfield=' + Greenfield.length); Greenfield[Greenfield.length] = createMarker(new GPoint(-83.38751221,39.35190582),"
Greenfield Middle School
200 N 5th St
Greenfield, OH 45123

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Greenfield Middle School",'Greenfield=' + Greenfield.length); Hillsboro[Hillsboro.length] = createMarker(new GPoint(-83.61277000,39.19704400),"
Hillsboro
500 U.s. Rte. 62
Hillsboro, OH 45133

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hillsboro",'Hillsboro=' + Hillsboro.length); Hillsboro[Hillsboro.length] = createMarker(new GPoint(-83.61598969,39.20137787),"
Hillsboro Elementary School
265 W Walnut St
Hillsboro, OH 45133

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hillsboro Elementary School",'Hillsboro=' + Hillsboro.length); Hillsboro[Hillsboro.length] = createMarker(new GPoint(-83.61772919,39.20303345),"
Hillsboro High School
358 W Main St
Hillsboro, OH 45133

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Hillsboro High School",'Hillsboro=' + Hillsboro.length); Hillsboro[Hillsboro.length] = createMarker(new GPoint(-83.61772919,39.20303345),"
Hillsboro Middle School
358 W Main St
Hillsboro, OH 45133

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Hillsboro Middle School",'Hillsboro=' + Hillsboro.length); Hillsboro[Hillsboro.length] = createMarker(new GPoint(-83.61261749,39.20106125),"
Idea Center
128 W Walnut St
Hillsboro, OH 45133

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Idea Center",'Hillsboro=' + Hillsboro.length); Lynchburg[Lynchburg.length] = createMarker(new GPoint(-83.81626892,39.19210434),"
Lynchburg-clay Elementary School
6760 State Route 134
Lynchburg, OH 45142

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lynchburg-clay Elementary School",'Lynchburg=' + Lynchburg.length); Lynchburg[Lynchburg.length] = createMarker(new GPoint(-83.81624603,39.19215775),"
Lynchburg-clay High School
6762 State Route 134
Lynchburg, OH 45142

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Lynchburg-clay High School",'Lynchburg=' + Lynchburg.length); Lynchburg[Lynchburg.length] = createMarker(new GPoint(-83.79563904,39.23190308),"
Lynchburg-clay Middle School
8250 State Route 134
Lynchburg, OH 45142

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Lynchburg-clay Middle School",'Lynchburg=' + Lynchburg.length); Hillsboro[Hillsboro.length] = createMarker(new GPoint(-83.60252380,39.20084763),"
Main Street Primary Elementary School
410 E Main St
Hillsboro, OH 45133

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Main Street Primary Elementary School",'Hillsboro=' + Hillsboro.length); Greenfield[Greenfield.length] = createMarker(new GPoint(-83.38751221,39.35190582),"
Mcclain High School
200 N 5th St
Greenfield, OH 45123

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mcclain High School",'Greenfield=' + Greenfield.length); Hillsboro[Hillsboro.length] = createMarker(new GPoint(-83.44536591,39.26335144),"
Petersburg Special Needs School
9057 Water St
Hillsboro, OH 45133

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Petersburg Special Needs School",'Hillsboro=' + Hillsboro.length); Greenfield[Greenfield.length] = createMarker(new GPoint(-83.41320038,39.29769897),"
Rainsboro Elementary School
12916 Barretts Mill Rd
Greenfield, OH 45123

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Rainsboro Elementary School",'Greenfield=' + Greenfield.length); Hillsboro[Hillsboro.length] = createMarker(new GPoint(-83.48723602,39.12893677),"
Washington Middle School
200 N East St
Hillsboro, OH 45133

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Washington Middle School",'Hillsboro=' + Hillsboro.length); Hillsboro[Hillsboro.length] = createMarker(new GPoint(-83.60860443,39.20303345),"
Webster Elementary School
200 N East St
Hillsboro, OH 45133

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Webster Elementary School",'Hillsboro=' + Hillsboro.length); Mowrystown[Mowrystown.length] = createMarker(new GPoint(-83.74859619,39.03829956),"
Whiteoak High School
Po Box 297
Mowrystown, OH 45155

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Whiteoak High School",'Mowrystown=' + Mowrystown.length); Mowrystown[Mowrystown.length] = createMarker(new GPoint(-83.74639300,39.04347000),"
Whiteoak Junior High School
44 N High St
Mowrystown, OH 45155

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Whiteoak Junior High School",'Mowrystown=' + Mowrystown.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(Greenfield); map.removeOverlays(Hillsboro); map.removeOverlays(Leesburg); map.removeOverlays(Lynchburg); map.removeOverlays(Mowrystown); 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(Hillsboro);map.removeOverlays(Greenfield); map.removeOverlays(Hillsboro); map.removeOverlays(Leesburg); map.removeOverlays(Lynchburg); map.removeOverlays(Mowrystown); map.addOverlays(Greenfield); centerByArray(Greenfield, false, false); cntMarker += Greenfield.length; map.addOverlays(Hillsboro); centerByArray(Hillsboro, false, false); cntMarker += Hillsboro.length; map.addOverlays(Leesburg); centerByArray(Leesburg, false, false); cntMarker += Leesburg.length; map.addOverlays(Lynchburg); centerByArray(Lynchburg, false, false); cntMarker += Lynchburg.length; map.addOverlays(Mowrystown); centerByArray(Mowrystown, false, false); cntMarker += Mowrystown.length; centerByArray(Hillsboro,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'); } }