function addMarkers(){ mySelect = document.getElementById('selection'); Auburn = [];Bay_City = [];Essexville = [];Kawkawlin = [];Linwood = [];Pinconning = [];mySelect.options[mySelect.options.length] = new Option("Auburn schools",'all=Auburn'); mySelect.options[mySelect.options.length] = new Option("Bay City schools",'all=Bay_City'); mySelect.options[mySelect.options.length] = new Option("Essexville schools",'all=Essexville'); mySelect.options[mySelect.options.length] = new Option("Kawkawlin schools",'all=Kawkawlin'); mySelect.options[mySelect.options.length] = new Option("Linwood schools",'all=Linwood'); mySelect.options[mySelect.options.length] = new Option("Pinconning schools",'all=Pinconning'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Auburn[Auburn.length] = createMarker(new GPoint(-84.07029200,43.60363700),"
Auburn Area Catholic School
114 West Midland Road
Auburn, MI 48611
Co-ed school, PK-5
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Auburn Area Catholic School",'Auburn=' + Auburn.length); Bay_City[Bay_City.length] = createMarker(new GPoint(-83.83710200,43.58677000),"
Bethel Lutheran School
749 N Pine Road
Bay City, MI 48708
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bethel Lutheran School",'Bay_City=' + Bay_City.length); Bay_City[Bay_City.length] = createMarker(new GPoint(-83.93022400,43.62413700),"
Faith Lutheran School
3033 Wilder Road
Bay City, MI 48706
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Faith Lutheran School",'Bay_City=' + Bay_City.length); Essexville[Essexville.length] = createMarker(new GPoint(-83.82409100,43.59406300),"
First Baptist Academy
1145 W. Center Rd
Essexville, MI 48732
Co-ed school, KG-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("First Baptist Academy",'Essexville=' + Essexville.length); Auburn[Auburn.length] = createMarker(new GPoint(-84.07413700,43.59916300),"
Grace Lutheran School
303 Ruth Street
Auburn, MI 48611
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Grace Lutheran School",'Auburn=' + Auburn.length); Bay_City[Bay_City.length] = createMarker(new GPoint(-83.88401000,43.56760200),"
Holy Family Middle School
2307 S Monroe Street
Bay City, MI 48708
Co-ed school, 6-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Holy Family Middle School",'Bay_City=' + Bay_City.length); Bay_City[Bay_City.length] = createMarker(new GPoint(-83.90578800,43.59026100),"
Holy Trinity Elementary School
1004 S Wenona Street
Bay City, MI 48706
Co-ed school, PK-5
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Holy Trinity Elementary School",'Bay_City=' + Bay_City.length); Bay_City[Bay_City.length] = createMarker(new GPoint(-83.87714100,43.59112600),"
Immanuel Lutheran School
247 N Lincoln Street
Bay City, MI 48708
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Immanuel Lutheran School",'Bay_City=' + Bay_City.length); Kawkawlin[Kawkawlin.length] = createMarker(new GPoint(-84.00753500,43.66763700),"
St. Bartholomew Lutheran School
1033 E. Beaver Rd.
Kawkawlin, MI 48631
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Bartholomew Lutheran School",'Kawkawlin=' + Kawkawlin.length); Bay_City[Bay_City.length] = createMarker(new GPoint(-83.88443700,43.58926300),"
St. James Preschool
710 Columbus
Bay City, MI 48708
Co-ed school, PK-5
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. James Preschool",'Bay_City=' + Bay_City.length); Bay_City[Bay_City.length] = createMarker(new GPoint(-83.91220600,43.60106700),"
St. Johns Lutheran School
210 S Alp Street
Bay City, MI 48706
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Johns Lutheran School",'Bay_City=' + Bay_City.length); Kawkawlin[Kawkawlin.length] = createMarker(new GPoint(-84.06788900,43.71100200),"
St. Valentine School
1010 9 Mile Road
Kawkawlin, MI 48631
Co-ed school, K-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Valentine School",'Kawkawlin=' + Kawkawlin.length); Linwood[Linwood.length] = createMarker(new GPoint(-84.02510000,43.74620000),"
St Anne Elementary School
317 W Center Street
Linwood, MI 48634
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Anne Elementary School",'Linwood=' + Linwood.length); Bay_City[Bay_City.length] = createMarker(new GPoint(-83.88550000,43.58783700),"
St James School
715 14th Street
Bay City, MI 48708
Co-ed school, PK-5
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St James School",'Bay_City=' + Bay_City.length); Bay_City[Bay_City.length] = createMarker(new GPoint(-83.98904300,43.53746700),"
St John Lutheran School
1664 Amelith Road
Bay City, MI 48706
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St John Lutheran School",'Bay_City=' + Bay_City.length); Essexville[Essexville.length] = createMarker(new GPoint(-83.84050900,43.61016800),"
St John School
619 Main Street
Essexville, MI 48732
Co-ed school, PK-5
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St John School",'Essexville=' + Essexville.length); Pinconning[Pinconning.length] = createMarker(new GPoint(-83.95855500,43.85636300),"
St Michael Elementary School
310 E 2nd Street
Pinconning, MI 48650
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Michael Elementary School",'Pinconning=' + Pinconning.length); Bay_City[Bay_City.length] = createMarker(new GPoint(-83.94268900,43.56368600),"
St Paul Lutheran School
6094 Westside Saginaw Road
Bay City, MI 48706
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Paul Lutheran School",'Bay_City=' + Bay_City.length); Bay_City[Bay_City.length] = createMarker(new GPoint(-83.88165800,43.58208800),"
St Stanislaus Elementary School
900 S Grant Street
Bay City, MI 48708
Co-ed school, PK-5
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Stanislaus Elementary School",'Bay_City=' + Bay_City.length); Bay_City[Bay_City.length] = createMarker(new GPoint(-83.89371000,43.56252700),"
Trinity Evang Lutheran School
2515 Broadway Street
Bay City, MI 48708
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Trinity Evang Lutheran School",'Bay_City=' + Bay_City.length); Bay_City[Bay_City.length] = createMarker(new GPoint(-84.04885100,43.58147500),"
Trinity Lutheran School
20 E Salzburg Road
Bay City, MI 48706
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Trinity Lutheran School",'Bay_City=' + Bay_City.length); Auburn[Auburn.length] = createMarker(new GPoint(-84.11020700,43.68256600),"
Zion Lutheran School
1557 Seidlers Road
Auburn, MI 48611
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Zion Lutheran School",'Auburn=' + Auburn.length); Bay_City[Bay_City.length] = createMarker(new GPoint(-83.91151000,43.58351800),"
Zion Lutheran School
1707 S Kiesel Street
Bay City, MI 48706
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Zion Lutheran School",'Bay_City=' + Bay_City.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(Auburn); map.removeOverlays(Bay_City); map.removeOverlays(Essexville); map.removeOverlays(Kawkawlin); map.removeOverlays(Linwood); map.removeOverlays(Pinconning); 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(Auburn);map.removeOverlays(Auburn); map.removeOverlays(Bay_City); map.removeOverlays(Essexville); map.removeOverlays(Kawkawlin); map.removeOverlays(Linwood); map.removeOverlays(Pinconning); map.addOverlays(Auburn); centerByArray(Auburn, false, false); cntMarker += Auburn.length; map.addOverlays(Bay_City); centerByArray(Bay_City, false, false); cntMarker += Bay_City.length; map.addOverlays(Essexville); centerByArray(Essexville, false, false); cntMarker += Essexville.length; map.addOverlays(Kawkawlin); centerByArray(Kawkawlin, false, false); cntMarker += Kawkawlin.length; map.addOverlays(Linwood); centerByArray(Linwood, false, false); cntMarker += Linwood.length; map.addOverlays(Pinconning); centerByArray(Pinconning, false, false); cntMarker += Pinconning.length; centerByArray(Auburn,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; }