function addMarkers(){ mySelect = document.getElementById('selection'); Rossford = [];Bowling_Green = [];Perrysburg = [];Risingsun = [];Walbridge = [];Custar = [];mySelect.options[mySelect.options.length] = new Option("Bowling Green schools",'all=Bowling_Green'); mySelect.options[mySelect.options.length] = new Option("Custar schools",'all=Custar'); mySelect.options[mySelect.options.length] = new Option("Perrysburg schools",'all=Perrysburg'); mySelect.options[mySelect.options.length] = new Option("Risingsun schools",'all=Risingsun'); mySelect.options[mySelect.options.length] = new Option("Rossford schools",'all=Rossford'); mySelect.options[mySelect.options.length] = new Option("Walbridge schools",'all=Walbridge'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Rossford[Rossford.length] = createMarker(new GPoint(-83.56731500,41.59605100),"
All Saints Catholic School
630 Lime City Road
Rossford, OH 43460
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("All Saints Catholic School",'Rossford=' + Rossford.length); Bowling_Green[Bowling_Green.length] = createMarker(new GPoint(-83.67048000,41.38887700),"
Bowling Green Christian Academy
1165 Haskins Road
Bowling Green, OH 43402
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bowling Green Christian Academy",'Bowling_Green=' + Bowling_Green.length); Perrysburg[Perrysburg.length] = createMarker(new GPoint(-83.60615600,41.54969900),"
Gathering Place
1134 Professional Drive
Perrysburg, OH 43551
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Gathering Place",'Perrysburg=' + Perrysburg.length); Perrysburg[Perrysburg.length] = createMarker(new GPoint(-83.61654600,41.53314100),"
Islamic School Of Greater Toledo
25877 Scheider Road
Perrysburg, OH 43551
Co-ed school, NS-7
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Islamic School Of Greater Toledo",'Perrysburg=' + Perrysburg.length); Bowling_Green[Bowling_Green.length] = createMarker(new GPoint(-83.65682200,41.36656200),"
Montessori School Of Bowling Green
515 Sand Ridge Road
Bowling Green, OH 43402
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Montessori School Of Bowling Green",'Bowling_Green=' + Bowling_Green.length); Bowling_Green[Bowling_Green.length] = createMarker(new GPoint(-83.65002800,41.37705900),"
Plan Do And Talk Primary School
115 E Oak Street
Bowling Green, OH 43402
Co-ed school, PK-1
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Plan Do And Talk Primary School",'Bowling_Green=' + Bowling_Green.length); Risingsun[Risingsun.length] = createMarker(new GPoint(-83.42770000,41.26600000),"
Risingsun Community Christian
238 St Rt 23, Po Box 57
Risingsun, OH 43457
Co-ed school, KG-5
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Risingsun Community Christian",'Risingsun=' + Risingsun.length); Bowling_Green[Bowling_Green.length] = createMarker(new GPoint(-83.65882900,41.38601500),"
St. Aloysius Elementary School
Po Box 485 148 S Enterprise St
Bowling Green, OH 43402
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Aloysius Elementary School",'Bowling_Green=' + Bowling_Green.length); Walbridge[Walbridge.length] = createMarker(new GPoint(-83.49111500,41.59346300),"
St Jerome Elementary School
300 Earl Street
Walbridge, OH 43465
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Jerome Elementary School",'Walbridge=' + Walbridge.length); Custar[Custar.length] = createMarker(new GPoint(-83.83565300,41.28473700),"
St Louis School
22776 Defiance Pike
Custar, OH 43511
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Louis School",'Custar=' + Custar.length); Perrysburg[Perrysburg.length] = createMarker(new GPoint(-83.62748400,41.56148200),"
St Rose Elementary School
217 East Front Street
Perrysburg, OH 43551
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Rose Elementary School",'Perrysburg=' + Perrysburg.length); Perrysburg[Perrysburg.length] = createMarker(new GPoint(-83.65496900,41.52205500),"
West Side Montessori Center
13587 Roachton Road
Perrysburg, OH 43551
Co-ed school, PK-KG
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("West Side Montessori Center",'Perrysburg=' + Perrysburg.length); Perrysburg[Perrysburg.length] = createMarker(new GPoint(-83.65496900,41.52205500),"
Westside Montessori Center
13587 Roachton Rd
Perrysburg, OH 43551
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Westside Montessori Center",'Perrysburg=' + Perrysburg.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,11); /* 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/////1/' + showArray); map.removeOverlays(Bowling_Green); map.removeOverlays(Custar); map.removeOverlays(Perrysburg); map.removeOverlays(Risingsun); map.removeOverlays(Rossford); map.removeOverlays(Walbridge); 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(Rossford);map.removeOverlays(Bowling_Green); map.removeOverlays(Custar); map.removeOverlays(Perrysburg); map.removeOverlays(Risingsun); map.removeOverlays(Rossford); map.removeOverlays(Walbridge); map.addOverlays(Bowling_Green); centerByArray(Bowling_Green, false, false); cntMarker += Bowling_Green.length; map.addOverlays(Custar); centerByArray(Custar, false, false); cntMarker += Custar.length; map.addOverlays(Perrysburg); centerByArray(Perrysburg, false, false); cntMarker += Perrysburg.length; map.addOverlays(Risingsun); centerByArray(Risingsun, false, false); cntMarker += Risingsun.length; map.addOverlays(Rossford); centerByArray(Rossford, false, false); cntMarker += Rossford.length; map.addOverlays(Walbridge); centerByArray(Walbridge, false, false); cntMarker += Walbridge.length; centerByArray(Rossford,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'); //window.open('/map.php?type=1&schools=&school_level=1&radius=&zipcode=&school_type_search=&school_type_code='); } } function createMarker(point, label, icon) { var marker = new GMarker(point, icon); var html = label; GEvent.addListener(marker, "click", function() { marker.openInfoWindowHtml(html); }); return marker; }