function addMarkers() { mySelect = document.getElementById('selection'); Georgetown = [];Sardinia = [];Fayetteville = [];Hamersville = [];Mount_Orab = [];Ripley = [];Aberdeen = [];Russellville = [];mySelect.options[mySelect.options.length] = new Option("Aberdeen schools",'all=Aberdeen'); mySelect.options[mySelect.options.length] = new Option("Fayetteville schools",'all=Fayetteville'); mySelect.options[mySelect.options.length] = new Option("Georgetown schools",'all=Georgetown'); mySelect.options[mySelect.options.length] = new Option("Hamersville schools",'all=Hamersville'); mySelect.options[mySelect.options.length] = new Option("Mount Orab schools",'all=Mount_Orab'); mySelect.options[mySelect.options.length] = new Option("Ripley schools",'all=Ripley'); mySelect.options[mySelect.options.length] = new Option("Russellville schools",'all=Russellville'); mySelect.options[mySelect.options.length] = new Option("Sardinia schools",'all=Sardinia'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Georgetown[Georgetown.length] = createMarker(new GPoint(-83.90717316,38.86796570),"
Alverda Reed Elementary School
406 W Plum St
Georgetown, OH 45121

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Alverda Reed Elementary School",'Georgetown=' + Georgetown.length); Sardinia[Sardinia.length] = createMarker(new GPoint(-83.79199982,38.98600006),"
Eastern High School
Po Box 49
Sardinia, OH 45171

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Eastern High School",'Sardinia=' + Sardinia.length); Sardinia[Sardinia.length] = createMarker(new GPoint(-83.79180145,38.97890091),"
Eastern Junior Junior High School
Po Box 25
Sardinia, OH 45171

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Eastern Junior Junior High School",'Sardinia=' + Sardinia.length); Fayetteville[Fayetteville.length] = createMarker(new GPoint(-83.93000031,39.18761826),"
Fayetteville-perry Elementary School
140 N East St
Fayetteville, OH 45118

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Fayetteville-perry Elementary School",'Fayetteville=' + Fayetteville.length); Fayetteville[Fayetteville.length] = createMarker(new GPoint(-83.93252563,39.18368149),"
Fayetteville-perry High School
501 S Apple St
Fayetteville, OH 45118

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Fayetteville-perry High School",'Fayetteville=' + Fayetteville.length); Fayetteville[Fayetteville.length] = createMarker(new GPoint(-83.93273163,39.18278122),"
Fayetteville-perry Middle School
601 S Apple St
Fayetteville, OH 45118

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Fayetteville-perry Middle School",'Fayetteville=' + Fayetteville.length); Georgetown[Georgetown.length] = createMarker(new GPoint(-83.90050507,38.88025665),"
Georgetown Jr/sr High School
987 Mount Orab Pike
Georgetown, OH 45121

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Georgetown Jr/sr High School",'Georgetown=' + Georgetown.length); Georgetown[Georgetown.length] = createMarker(new GPoint(-83.90050507,38.88025665),"
Georgetown Middle School
987 Mount Orab Pike
Georgetown, OH 45121

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Georgetown Middle School",'Georgetown=' + Georgetown.length); Hamersville[Hamersville.length] = createMarker(new GPoint(-83.99770355,38.91450119),"
Hamersville Elementary School
Po Box 205
Hamersville, OH 45130

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hamersville Elementary School",'Hamersville=' + Hamersville.length); Mount_Orab[Mount_Orab.length] = createMarker(new GPoint(-83.93606567,39.03116989),"
Mt Orab Middle School
472 W Main St
Mount Orab, OH 45154

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Mt Orab Middle School",'Mount_Orab=' + Mount_Orab.length); Mount_Orab[Mount_Orab.length] = createMarker(new GPoint(-83.93669891,39.03132248),"
Mt Orab Primary Elementary School
474 W Main St
Mount Orab, OH 45154

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mt Orab Primary Elementary School",'Mount_Orab=' + Mount_Orab.length); Ripley[Ripley.length] = createMarker(new GPoint(-83.84096527,38.73883057),"
Ripley Union Lewis Huntington Elementary School
502 S 2nd St
Ripley, OH 45167

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Ripley Union Lewis Huntington Elementary School",'Ripley=' + Ripley.length); Aberdeen[Aberdeen.length] = createMarker(new GPoint(-83.77393600,38.68161400),"
Ripley Union Lewis Huntington Middle School
2300 Rains-eitel Rd.
Aberdeen, OH 45101

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Ripley Union Lewis Huntington Middle School",'Aberdeen=' + Aberdeen.length); Ripley[Ripley.length] = createMarker(new GPoint(-83.81680298,38.76129913),"
Ripley-union-lewis-huntington High School
1317 S 2nd St
Ripley, OH 45167

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Ripley-union-lewis-huntington High School",'Ripley=' + Ripley.length); Russellville[Russellville.length] = createMarker(new GPoint(-83.79199982,38.86723328),"
Russellville Elementary School
239 W Main St
Russellville, OH 45168

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Russellville Elementary School",'Russellville=' + Russellville.length); Sardinia[Sardinia.length] = createMarker(new GPoint(-83.79180145,38.97890091),"
Sardinia Elementary School
Po Box 67
Sardinia, OH 45171

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Sardinia Elementary School",'Sardinia=' + Sardinia.length); Georgetown[Georgetown.length] = createMarker(new GPoint(-83.89138031,38.88826752),"
Southern Hills High School
9193 Hamer Rd
Georgetown, OH 45121

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Southern Hills High School",'Georgetown=' + Georgetown.length); Mount_Orab[Mount_Orab.length] = createMarker(new GPoint(-83.93688202,39.03136444),"
Western Brown High School
476 W Main St
Mount Orab, OH 45154

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Western Brown High School",'Mount_Orab=' + Mount_Orab.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(Aberdeen); map.removeOverlays(Fayetteville); map.removeOverlays(Georgetown); map.removeOverlays(Hamersville); map.removeOverlays(Mount_Orab); map.removeOverlays(Ripley); map.removeOverlays(Russellville); map.removeOverlays(Sardinia); 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(Georgetown);map.removeOverlays(Aberdeen); map.removeOverlays(Fayetteville); map.removeOverlays(Georgetown); map.removeOverlays(Hamersville); map.removeOverlays(Mount_Orab); map.removeOverlays(Ripley); map.removeOverlays(Russellville); map.removeOverlays(Sardinia); map.addOverlays(Aberdeen); centerByArray(Aberdeen, false, false); cntMarker += Aberdeen.length; map.addOverlays(Fayetteville); centerByArray(Fayetteville, false, false); cntMarker += Fayetteville.length; map.addOverlays(Georgetown); centerByArray(Georgetown, false, false); cntMarker += Georgetown.length; map.addOverlays(Hamersville); centerByArray(Hamersville, false, false); cntMarker += Hamersville.length; map.addOverlays(Mount_Orab); centerByArray(Mount_Orab, false, false); cntMarker += Mount_Orab.length; map.addOverlays(Ripley); centerByArray(Ripley, false, false); cntMarker += Ripley.length; map.addOverlays(Russellville); centerByArray(Russellville, false, false); cntMarker += Russellville.length; map.addOverlays(Sardinia); centerByArray(Sardinia, false, false); cntMarker += Sardinia.length; centerByArray(Georgetown,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'); } }