function addMarkers() { mySelect = document.getElementById('selection'); Defiance = [];Sherwood = [];Farmer = [];Hicksville = [];mySelect.options[mySelect.options.length] = new Option("Defiance schools",'all=Defiance'); mySelect.options[mySelect.options.length] = new Option("Farmer schools",'all=Farmer'); mySelect.options[mySelect.options.length] = new Option("Hicksville schools",'all=Hicksville'); mySelect.options[mySelect.options.length] = new Option("Sherwood schools",'all=Sherwood'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Defiance[Defiance.length] = createMarker(new GPoint(-84.39109039,41.26067352),"
Anthony Wayne Elementary School
1745 S Clinton St
Defiance, OH 43512

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Anthony Wayne Elementary School",'Defiance=' + Defiance.length); Defiance[Defiance.length] = createMarker(new GPoint(-84.28514862,41.23816299),"
Ayersville Elementary School
28046 Watson Rd
Defiance, OH 43512

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Ayersville Elementary School",'Defiance=' + Defiance.length); Defiance[Defiance.length] = createMarker(new GPoint(-84.28514862,41.23816299),"
Ayersville High School
28046 Watson Rd
Defiance, OH 43512

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Ayersville High School",'Defiance=' + Defiance.length); Defiance[Defiance.length] = createMarker(new GPoint(-84.28514862,41.23816299),"
Ayersville Middle School
28046 Watson Rd
Defiance, OH 43512

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Ayersville Middle School",'Defiance=' + Defiance.length); Defiance[Defiance.length] = createMarker(new GPoint(-84.35070038,41.28271866),"
Brickell Elementary School
601 E 2nd St
Defiance, OH 43512

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Brickell Elementary School",'Defiance=' + Defiance.length); Defiance[Defiance.length] = createMarker(new GPoint(-84.36105347,41.26350403),"
Defiance High School
1755 Palmer Dr
Defiance, OH 43512

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Defiance High School",'Defiance=' + Defiance.length); Defiance[Defiance.length] = createMarker(new GPoint(-84.36472321,41.28164673),"
Defiance Junior High School
629 Arabella St
Defiance, OH 43512

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Defiance Junior High School",'Defiance=' + Defiance.length); Defiance[Defiance.length] = createMarker(new GPoint(-84.36746216,41.28085327),"
Defiance Middle School
801 S Clinton St
Defiance, OH 43512

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Defiance Middle School",'Defiance=' + Defiance.length); Sherwood[Sherwood.length] = createMarker(new GPoint(-84.55709839,41.29750061),"
Fairview Elementary School
14060 Blosser Rd
Sherwood, OH 43556

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Fairview Elementary School",'Sherwood=' + Sherwood.length); Sherwood[Sherwood.length] = createMarker(new GPoint(-84.55421448,41.34844589),"
Fairview High School
6289 Us Highway 127
Sherwood, OH 43556

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Fairview High School",'Sherwood=' + Sherwood.length); Sherwood[Sherwood.length] = createMarker(new GPoint(-84.55421448,41.34844589),"
Fairview Middle School
6289 Us Highway 127
Sherwood, OH 43556

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Fairview Middle School",'Sherwood=' + Sherwood.length); Farmer[Farmer.length] = createMarker(new GPoint(-84.63111877,41.38338852),"
Farmer Elementary School
10128 St Rt 249
Farmer, OH 43520

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Farmer Elementary School",'Farmer=' + Farmer.length); Hicksville[Hicksville.length] = createMarker(new GPoint(-84.76804352,41.29445648),"
Hicksville Elementary School
200 W Arthur St
Hicksville, OH 43526

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hicksville Elementary School",'Hicksville=' + Hicksville.length); Hicksville[Hicksville.length] = createMarker(new GPoint(-84.76564789,41.29294968),"
Hicksville High School
105 W Smith St
Hicksville, OH 43526

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Hicksville High School",'Hicksville=' + Hicksville.length); Defiance[Defiance.length] = createMarker(new GPoint(-84.38758087,41.30540085),"
Noble Elementary School
10553 Haller St
Defiance, OH 43512

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Noble Elementary School",'Defiance=' + Defiance.length); Defiance[Defiance.length] = createMarker(new GPoint(-84.35626984,41.28355789),"
North Richland-adams Elementa Elementary School
06950 Independence Rd, Rt 4
Defiance, OH 43512

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("North Richland-adams Elementa Elementary School",'Defiance=' + Defiance.length); Sherwood[Sherwood.length] = createMarker(new GPoint(-84.55321503,41.28962708),"
Sherwood Elementary School
405 N Harrison St, Po Box 4506
Sherwood, OH 43556

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Sherwood Elementary School",'Sherwood=' + Sherwood.length); Defiance[Defiance.length] = createMarker(new GPoint(-84.36694336,41.28230667),"
Slocum Elementary School
620 Thurston St
Defiance, OH 43512

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Slocum Elementary School",'Defiance=' + Defiance.length); Defiance[Defiance.length] = createMarker(new GPoint(-84.35997772,41.29171753),"
Spencer Elementary School
140 E Broadway St
Defiance, OH 43512

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Spencer Elementary School",'Defiance=' + Defiance.length); Defiance[Defiance.length] = createMarker(new GPoint(-84.35626984,41.28355789),"
Tiffin Elementary School
03876 Stever Rd, Rt 2
Defiance, OH 43512

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Tiffin Elementary School",'Defiance=' + Defiance.length); Defiance[Defiance.length] = createMarker(new GPoint(-84.32361603,41.35873032),"
Tinora Elementary School
5751 Domersville Rd
Defiance, OH 43512

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Tinora Elementary School",'Defiance=' + Defiance.length); Defiance[Defiance.length] = createMarker(new GPoint(-84.32361603,41.35633850),"
Tinora High School
5921 Domersville Rd
Defiance, OH 43512

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Tinora High School",'Defiance=' + Defiance.length); Defiance[Defiance.length] = createMarker(new GPoint(-84.32361603,41.35633850),"
Tinora Junior High School
5921 Domersville Rd
Defiance, OH 43512

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Tinora Junior High School",'Defiance=' + Defiance.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(Defiance); map.removeOverlays(Farmer); map.removeOverlays(Hicksville); map.removeOverlays(Sherwood); 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(Defiance);map.removeOverlays(Defiance); map.removeOverlays(Farmer); map.removeOverlays(Hicksville); map.removeOverlays(Sherwood); map.addOverlays(Defiance); centerByArray(Defiance, false, false); cntMarker += Defiance.length; map.addOverlays(Farmer); centerByArray(Farmer, false, false); cntMarker += Farmer.length; map.addOverlays(Hicksville); centerByArray(Hicksville, false, false); cntMarker += Hicksville.length; map.addOverlays(Sherwood); centerByArray(Sherwood, false, false); cntMarker += Sherwood.length; centerByArray(Defiance,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'); } }