function addMarkers() { mySelect = document.getElementById('selection'); Beaver = [];Waverly = [];Piketon = [];Stockdale = [];Latham = [];mySelect.options[mySelect.options.length] = new Option("Beaver schools",'all=Beaver'); mySelect.options[mySelect.options.length] = new Option("Latham schools",'all=Latham'); mySelect.options[mySelect.options.length] = new Option("Piketon schools",'all=Piketon'); mySelect.options[mySelect.options.length] = new Option("Stockdale schools",'all=Stockdale'); mySelect.options[mySelect.options.length] = new Option("Waverly schools",'all=Waverly'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Beaver[Beaver.length] = createMarker(new GPoint(-82.83910370,39.02230072),"
Beaver Elementary School
Po Box 225, Main St
Beaver, OH 45613

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Beaver Elementary School",'Beaver=' + Beaver.length); Waverly[Waverly.length] = createMarker(new GPoint(-82.98034668,39.12469864),"
East Primary Elementary School
7 Tiger Drive
Waverly, OH 45690

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("East Primary Elementary School",'Waverly=' + Waverly.length); Beaver[Beaver.length] = createMarker(new GPoint(-82.84584045,39.03305054),"
Eastern High School
1170 Tile Mill Rd
Beaver, OH 45613

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Eastern High School",'Beaver=' + Beaver.length); Beaver[Beaver.length] = createMarker(new GPoint(-82.84584045,39.03305054),"
Eastern Intermediate Elementary School
1170 Tile Mill Rd
Beaver, OH 45613

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Eastern Intermediate Elementary School",'Beaver=' + Beaver.length); Beaver[Beaver.length] = createMarker(new GPoint(-82.84584045,39.03305054),"
Eastern Middle School
1170 Tile Mill Rd
Beaver, OH 45613

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Eastern Middle School",'Beaver=' + Beaver.length); Beaver[Beaver.length] = createMarker(new GPoint(-82.84584045,39.03305054),"
Eastern Primary Elementary School
1170 Tile Mill Rd
Beaver, OH 45613

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Eastern Primary Elementary School",'Beaver=' + Beaver.length); Piketon[Piketon.length] = createMarker(new GPoint(-82.96324921,39.05297470),"
Jasper Elementary School
3185 Jasper Rd
Piketon, OH 45661

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Jasper Elementary School",'Piketon=' + Piketon.length); Waverly[Waverly.length] = createMarker(new GPoint(-82.97357178,39.13256836),"
North Junior High School
3 Tiger Drive
Waverly, OH 45690

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("North Junior High School",'Waverly=' + Waverly.length); Piketon[Piketon.length] = createMarker(new GPoint(-83.06057739,39.05172348),"
Parker Elementary School
12599 State Route 124
Piketon, OH 45661

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Parker Elementary School",'Piketon=' + Piketon.length); Piketon[Piketon.length] = createMarker(new GPoint(-83.00725800,39.06945000),"
Piketon Jr/sr High School
1414 Piketon Rd
Piketon, OH 45661

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Piketon Jr/sr High School",'Piketon=' + Piketon.length); Stockdale[Stockdale.length] = createMarker(new GPoint(-82.83910370,39.02230072),"
Stockdale Elementary School
Po Box 3, St Rt 335
Stockdale, OH 45683

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Stockdale Elementary School",'Stockdale=' + Stockdale.length); Piketon[Piketon.length] = createMarker(new GPoint(-83.05490112,39.04570007),"
Vern Riffe Career Technology C High School
Po Box 577
Piketon, OH 45661

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Vern Riffe Career Technology C High School",'Piketon=' + Piketon.length); Waverly[Waverly.length] = createMarker(new GPoint(-82.98067474,39.13010788),"
Waverly High School
1 Tiger Drive
Waverly, OH 45690

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Waverly High School",'Waverly=' + Waverly.length); Waverly[Waverly.length] = createMarker(new GPoint(-82.98126984,39.13057709),"
West Intermediate Elementary School
5 Tiger Drive
Waverly, OH 45690

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("West Intermediate Elementary School",'Waverly=' + Waverly.length); Latham[Latham.length] = createMarker(new GPoint(-83.32060242,39.07960129),"
Western High School
Po Box 129
Latham, OH 45646

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Western High School",'Latham=' + Latham.length); Piketon[Piketon.length] = createMarker(new GPoint(-83.01672363,39.06637573),"
Zahns Middle School
2379 Schuster Rd
Piketon, OH 45661

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Zahns Middle School",'Piketon=' + Piketon.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(Beaver); map.removeOverlays(Latham); map.removeOverlays(Piketon); map.removeOverlays(Stockdale); map.removeOverlays(Waverly); 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(Beaver);map.removeOverlays(Beaver); map.removeOverlays(Latham); map.removeOverlays(Piketon); map.removeOverlays(Stockdale); map.removeOverlays(Waverly); map.addOverlays(Beaver); centerByArray(Beaver, false, false); cntMarker += Beaver.length; map.addOverlays(Latham); centerByArray(Latham, false, false); cntMarker += Latham.length; map.addOverlays(Piketon); centerByArray(Piketon, false, false); cntMarker += Piketon.length; map.addOverlays(Stockdale); centerByArray(Stockdale, false, false); cntMarker += Stockdale.length; map.addOverlays(Waverly); centerByArray(Waverly, false, false); cntMarker += Waverly.length; centerByArray(Beaver,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'); } }