function addMarkers() { mySelect = document.getElementById('selection'); Toledo = [];Toledo[Toledo.length] = createMarker(new GPoint(-83.58901215,41.68204880),"
Bond Hill Academy Elementary School
3310 Upton Ave
Toledo, OH 43613

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bond Hill Academy Elementary School",'Toledo=' + Toledo.length); Toledo[Toledo.length] = createMarker(new GPoint(-83.60759735,41.69223785),"
Deveaux Junior High School
2626 W Sylvania Ave
Toledo, OH 43613

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Deveaux Junior High School",'Toledo=' + Toledo.length); Toledo[Toledo.length] = createMarker(new GPoint(-83.61551666,41.69961548),"
Elmhurst Elementary School
4530 Elmhurst Rd
Toledo, OH 43613

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Elmhurst Elementary School",'Toledo=' + Toledo.length); Toledo[Toledo.length] = createMarker(new GPoint(-83.61750031,41.71273804),"
Hiawatha Elementary School
3020 Photos Dr
Toledo, OH 43613

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hiawatha Elementary School",'Toledo=' + Toledo.length); Toledo[Toledo.length] = createMarker(new GPoint(-83.58938599,41.68185806),"
International Studies Center
3301 Upton Ave
Toledo, OH 43613

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("International Studies Center",'Toledo=' + Toledo.length); Toledo[Toledo.length] = createMarker(new GPoint(-83.59271240,41.71398926),"
Jackman Elementary School
2010 Northover Rd
Toledo, OH 43613

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Jackman Elementary School",'Toledo=' + Toledo.length); Toledo[Toledo.length] = createMarker(new GPoint(-83.61354828,41.71642685),"
Jefferson Junior High School
5530 Whitmer Dr
Toledo, OH 43613

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Jefferson Junior High School",'Toledo=' + Toledo.length); Toledo[Toledo.length] = createMarker(new GPoint(-83.61183167,41.72602081),"
Meadowvale Elementary School
2755 Edgebrook Dr
Toledo, OH 43613

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Meadowvale Elementary School",'Toledo=' + Toledo.length); Toledo[Toledo.length] = createMarker(new GPoint(-83.59452057,41.69890213),"
Start High School
2100 Tremainsville Rd
Toledo, OH 43613

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Start High School",'Toledo=' + Toledo.length); Toledo[Toledo.length] = createMarker(new GPoint(-83.58938599,41.68185806),"
Toledo Technology Academy
3310 Upton Ave
Toledo, OH 43613

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Toledo Technology Academy",'Toledo=' + Toledo.length); Toledo[Toledo.length] = createMarker(new GPoint(-83.61366272,41.71911240),"
Washington Junior High School
5700 Whitmer Dr
Toledo, OH 43613

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Washington Junior High School",'Toledo=' + Toledo.length); Toledo[Toledo.length] = createMarker(new GPoint(-83.60391998,41.70792007),"
Wernert Elementary School
5050 Douglas Rd
Toledo, OH 43613

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Wernert Elementary School",'Toledo=' + Toledo.length); Toledo[Toledo.length] = createMarker(new GPoint(-83.60989380,41.71735382),"
Whitmer High School
5601 Clegg Dr
Toledo, OH 43613

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Whitmer High School",'Toledo=' + Toledo.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(Toledo); 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(Toledo);map.removeOverlays(Toledo); map.addOverlays(Toledo); centerByArray(Toledo, false, false); cntMarker += Toledo.length; centerByArray(Toledo,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'); } }