function addMarkers() { mySelect = document.getElementById('selection'); Ansonia = [];Arcanum = [];Greenville = [];Pitsburg = [];Gettysburg = [];Union_City = [];North_Star = [];New_Madison = [];Versailles = [];mySelect.options[mySelect.options.length] = new Option("Ansonia schools",'all=Ansonia'); mySelect.options[mySelect.options.length] = new Option("Arcanum schools",'all=Arcanum'); mySelect.options[mySelect.options.length] = new Option("Gettysburg schools",'all=Gettysburg'); mySelect.options[mySelect.options.length] = new Option("Greenville schools",'all=Greenville'); mySelect.options[mySelect.options.length] = new Option("New Madison schools",'all=New_Madison'); mySelect.options[mySelect.options.length] = new Option("North Star schools",'all=North_Star'); mySelect.options[mySelect.options.length] = new Option("Pitsburg schools",'all=Pitsburg'); mySelect.options[mySelect.options.length] = new Option("Union City schools",'all=Union_City'); mySelect.options[mySelect.options.length] = new Option("Versailles schools",'all=Versailles'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Ansonia[Ansonia.length] = createMarker(new GPoint(-84.63623047,40.21563721),"
Ansonia Elementary School
Po Box 279
Ansonia, OH 45303

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Ansonia Elementary School",'Ansonia=' + Ansonia.length); Ansonia[Ansonia.length] = createMarker(new GPoint(-84.64279938,40.21400070),"
Ansonia High School
Po Box 279
Ansonia, OH 45303

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Ansonia High School",'Ansonia=' + Ansonia.length); Ansonia[Ansonia.length] = createMarker(new GPoint(-84.64297485,40.21443558),"
Ansonia Middle School
Po Box 279
Ansonia, OH 45303

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Ansonia Middle School",'Ansonia=' + Ansonia.length); Arcanum[Arcanum.length] = createMarker(new GPoint(-84.55347443,39.99365234),"
Arcanum Elementary School
310 N Main St
Arcanum, OH 45304

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Arcanum Elementary School",'Arcanum=' + Arcanum.length); Arcanum[Arcanum.length] = createMarker(new GPoint(-84.55042267,39.92825699),"
Arcanum High School
310 S Main St
Arcanum, OH 45304

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Arcanum High School",'Arcanum=' + Arcanum.length); Arcanum[Arcanum.length] = createMarker(new GPoint(-84.63202667,39.95758057),"
Butler Middle School
1481 State Route 127
Arcanum, OH 45304

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Butler Middle School",'Arcanum=' + Arcanum.length); Greenville[Greenville.length] = createMarker(new GPoint(-84.62803650,40.10158539),"
East Elementary School
300 E 5th St
Greenville, OH 45331

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("East Elementary School",'Greenville=' + Greenville.length); Arcanum[Arcanum.length] = createMarker(new GPoint(-84.46830750,40.05051422),"
Franklin Monroe Elementary School
8982 Hogpath Rd
Arcanum, OH 45304

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Franklin Monroe Elementary School",'Arcanum=' + Arcanum.length); Pitsburg[Pitsburg.length] = createMarker(new GPoint(-84.48750305,39.98749924),"
Franklin Monroe High School
Po Box 78
Pitsburg, OH 45358

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Franklin Monroe High School",'Pitsburg=' + Pitsburg.length); Gettysburg[Gettysburg.length] = createMarker(new GPoint(-84.49281311,40.11226654),"
Gettysburg Elementary School
260 E Main St
Gettysburg, OH 45328

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Gettysburg Elementary School",'Gettysburg=' + Gettysburg.length); Greenville[Greenville.length] = createMarker(new GPoint(-84.63392639,40.09895706),"
Greenville Junior High School
131 Central Ave
Greenville, OH 45331

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Greenville Junior High School",'Greenville=' + Greenville.length); Greenville[Greenville.length] = createMarker(new GPoint(-84.63147736,40.11370468),"
Greenville Senior High School
100 Greenwave Way
Greenville, OH 45331

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Greenville Senior High School",'Greenville=' + Greenville.length); Union_City[Union_City.length] = createMarker(new GPoint(-84.74697876,40.22171783),"
Mississinawa Valley Elementary School
10480 Staudt Rd
Union City, OH 45390

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mississinawa Valley Elementary School",'Union_City=' + Union_City.length); Union_City[Union_City.length] = createMarker(new GPoint(-84.79860900,40.19721500),"
Mississinawa Valley Jr/sr High School
10480 Staudt Rd
Union City, OH 45390

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mississinawa Valley Jr/sr High School",'Union_City=' + Union_City.length); Union_City[Union_City.length] = createMarker(new GPoint(-84.75216675,40.22239304),"
Mississinawa Valley Middle School
1369 St Rt 47
Union City, OH 45390

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Mississinawa Valley Middle School",'Union_City=' + Union_City.length); Greenville[Greenville.length] = createMarker(new GPoint(-84.63843536,40.10575867),"
North Middle School
214 N Main St
Greenville, OH 45331

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("North Middle School",'Greenville=' + Greenville.length); North_Star[North_Star.length] = createMarker(new GPoint(-84.56870270,40.32479858),"
North Star Elementary School
Po Box 159
North Star, OH 45350

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("North Star Elementary School",'North_Star=' + North_Star.length); Greenville[Greenville.length] = createMarker(new GPoint(-84.63140106,40.09225464),"
South Elementary School
701 Wayne Ave
Greenville, OH 45331

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("South Elementary School",'Greenville=' + Greenville.length); New_Madison[New_Madison.length] = createMarker(new GPoint(-84.79250336,39.99670029),"
Tri-village Elementary School
Po Box 31
New Madison, OH 45346

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Tri-village Elementary School",'New_Madison=' + New_Madison.length); New_Madison[New_Madison.length] = createMarker(new GPoint(-84.71910095,39.96799850),"
Tri-village High School
Po Box 31
New Madison, OH 45346

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Tri-village High School",'New_Madison=' + New_Madison.length); Versailles[Versailles.length] = createMarker(new GPoint(-84.49739838,40.23149872),"
Versailles Elementary School
Po Box 313
Versailles, OH 45380

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Versailles Elementary School",'Versailles=' + Versailles.length); Versailles[Versailles.length] = createMarker(new GPoint(-84.49739838,40.23149872),"
Versailles High School
Po Box 313
Versailles, OH 45380

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Versailles High School",'Versailles=' + Versailles.length); Versailles[Versailles.length] = createMarker(new GPoint(-84.49739838,40.23149872),"
Versailles Middle School
Po Box 313
Versailles, OH 45380

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Versailles Middle School",'Versailles=' + Versailles.length); Greenville[Greenville.length] = createMarker(new GPoint(-84.63742065,40.13595581),"
Woodland Heights Elementary School
7550 State Route 118
Greenville, OH 45331

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Woodland Heights Elementary School",'Greenville=' + Greenville.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(Ansonia); map.removeOverlays(Arcanum); map.removeOverlays(Gettysburg); map.removeOverlays(Greenville); map.removeOverlays(New_Madison); map.removeOverlays(North_Star); map.removeOverlays(Pitsburg); map.removeOverlays(Union_City); map.removeOverlays(Versailles); 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(Ansonia);map.removeOverlays(Ansonia); map.removeOverlays(Arcanum); map.removeOverlays(Gettysburg); map.removeOverlays(Greenville); map.removeOverlays(New_Madison); map.removeOverlays(North_Star); map.removeOverlays(Pitsburg); map.removeOverlays(Union_City); map.removeOverlays(Versailles); map.addOverlays(Ansonia); centerByArray(Ansonia, false, false); cntMarker += Ansonia.length; map.addOverlays(Arcanum); centerByArray(Arcanum, false, false); cntMarker += Arcanum.length; map.addOverlays(Gettysburg); centerByArray(Gettysburg, false, false); cntMarker += Gettysburg.length; map.addOverlays(Greenville); centerByArray(Greenville, false, false); cntMarker += Greenville.length; map.addOverlays(New_Madison); centerByArray(New_Madison, false, false); cntMarker += New_Madison.length; map.addOverlays(North_Star); centerByArray(North_Star, false, false); cntMarker += North_Star.length; map.addOverlays(Pitsburg); centerByArray(Pitsburg, false, false); cntMarker += Pitsburg.length; map.addOverlays(Union_City); centerByArray(Union_City, false, false); cntMarker += Union_City.length; map.addOverlays(Versailles); centerByArray(Versailles, false, false); cntMarker += Versailles.length; centerByArray(Ansonia,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'); } }