function addMarkers(){ mySelect = document.getElementById('selection'); Saginaw = [];Bridgeport = [];Oakley = [];Chesaning = [];Frankenmuth = [];Hemlock = [];Reese = [];mySelect.options[mySelect.options.length] = new Option("Bridgeport schools",'all=Bridgeport'); mySelect.options[mySelect.options.length] = new Option("Chesaning schools",'all=Chesaning'); mySelect.options[mySelect.options.length] = new Option("Frankenmuth schools",'all=Frankenmuth'); mySelect.options[mySelect.options.length] = new Option("Hemlock schools",'all=Hemlock'); mySelect.options[mySelect.options.length] = new Option("Oakley schools",'all=Oakley'); mySelect.options[mySelect.options.length] = new Option("Reese schools",'all=Reese'); mySelect.options[mySelect.options.length] = new Option("Saginaw schools",'all=Saginaw'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Saginaw[Saginaw.length] = createMarker(new GPoint(-84.01720600,43.46546300),"
Bethany Lutheran School
5051 Mccarty Road
Saginaw, MI 48603
Co-ed school, PK-4
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bethany Lutheran School",'Saginaw=' + Saginaw.length); Saginaw[Saginaw.length] = createMarker(new GPoint(-84.00880500,43.42731800),"
Bethany St John's Lutheran School
4705 Brockway Road
Saginaw, MI 48638
Co-ed school, 5-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bethany St John's Lutheran School",'Saginaw=' + Saginaw.length); Saginaw[Saginaw.length] = createMarker(new GPoint(-83.95248800,43.44515700),"
Bethlehem Lutheran School
2777 Hermansau Road
Saginaw, MI 48604
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bethlehem Lutheran School",'Saginaw=' + Saginaw.length); Bridgeport[Bridgeport.length] = createMarker(new GPoint(-83.85930000,43.35020000),"
Bridgeport Baptist Academy
Po Box 274
Bridgeport, MI 48722
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bridgeport Baptist Academy",'Bridgeport=' + Bridgeport.length); Oakley[Oakley.length] = createMarker(new GPoint(-84.22931800,43.18693700),"
Christ Lutheran School
16070 W Brady Road
Oakley, MI 48649
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Christ Lutheran School",'Oakley=' + Oakley.length); Saginaw[Saginaw.length] = createMarker(new GPoint(-84.07672200,43.41586300),"
Community Baptist Christian School
8331 Gratiot Road
Saginaw, MI 48609
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Community Baptist Christian School",'Saginaw=' + Saginaw.length); Saginaw[Saginaw.length] = createMarker(new GPoint(-83.98380000,43.44516300),"
Gethsemane Lutheran School
3412 Crestmont Drive
Saginaw, MI 48603
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Gethsemane Lutheran School",'Saginaw=' + Saginaw.length); Saginaw[Saginaw.length] = createMarker(new GPoint(-84.02174200,43.43215200),"
Good Shepherd Early Childhood
5335 Brockway Road
Saginaw, MI 48638
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Good Shepherd Early Childhood",'Saginaw=' + Saginaw.length); Saginaw[Saginaw.length] = createMarker(new GPoint(-83.99543300,43.45516500),"
Grace Christian School
4619 Mackinaw Rd
Saginaw, MI 48603
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Grace Christian School",'Saginaw=' + Saginaw.length); Saginaw[Saginaw.length] = createMarker(new GPoint(-84.02941000,43.43924400),"
Growing Years Christian School
2190 Wieneke Rd.
Saginaw, MI 48603
Co-ed school, PK-KG
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Growing Years Christian School",'Saginaw=' + Saginaw.length); Saginaw[Saginaw.length] = createMarker(new GPoint(-83.96524800,43.41843600),"
Holy Cross Lutheran School
610 Court Street
Saginaw, MI 48602
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Holy Cross Lutheran School",'Saginaw=' + Saginaw.length); Saginaw[Saginaw.length] = createMarker(new GPoint(-83.79054300,43.40697700),"
Immanuel Lutheran School
8220 E Holland Road
Saginaw, MI 48601
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Immanuel Lutheran School",'Saginaw=' + Saginaw.length); Chesaning[Chesaning.length] = createMarker(new GPoint(-84.12309500,43.18175400),"
Our Lady Of Perpetual Help School
802 Lockwood Street
Chesaning, MI 48616
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Our Lady Of Perpetual Help School",'Chesaning=' + Chesaning.length); Saginaw[Saginaw.length] = createMarker(new GPoint(-84.03452000,43.45440200),"
Peace Lutheran School
3161 Lawndale Road
Saginaw, MI 48603
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Peace Lutheran School",'Saginaw=' + Saginaw.length); Saginaw[Saginaw.length] = createMarker(new GPoint(-84.00993100,43.40069000),"
S S Peter And Paul School
4735 W Michigan Avenue
Saginaw, MI 48603
Co-ed school, KG-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("S S Peter And Paul School",'Saginaw=' + Saginaw.length); Saginaw[Saginaw.length] = createMarker(new GPoint(-83.94581000,43.45076300),"
St. Josaphat Elementary School
479 Shattuck Road
Saginaw, MI 48604
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Josaphat Elementary School",'Saginaw=' + Saginaw.length); Frankenmuth[Frankenmuth.length] = createMarker(new GPoint(-83.74858800,43.33661300),"
St. Lorenz Lutheran
140 Churchgrove Road
Frankenmuth, MI 48734
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Lorenz Lutheran",'Frankenmuth=' + Frankenmuth.length); Hemlock[Hemlock.length] = createMarker(new GPoint(-84.21016100,43.44223300),"
St. Peter Lutheran School
2440 N Raucholz Road
Hemlock, MI 48626
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Peter Lutheran School",'Hemlock=' + Hemlock.length); Saginaw[Saginaw.length] = createMarker(new GPoint(-84.02131000,43.43846500),"
St. Thomas Aquinas Elementary School
2136 Berberovich Drive
Saginaw, MI 48603
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Thomas Aquinas Elementary School",'Saginaw=' + Saginaw.length); Saginaw[Saginaw.length] = createMarker(new GPoint(-83.93357300,43.32355200),"
Sheridan Road Baptist School
6911 Sheridan Road
Saginaw, MI 48601
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Sheridan Road Baptist School",'Saginaw=' + Saginaw.length); Reese[Reese.length] = createMarker(new GPoint(-83.69800000,43.45810000),"
St Elizabeth Area Catholic School
Po Box 392
Reese, MI 48757
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Elizabeth Area Catholic School",'Reese=' + Reese.length); Saginaw[Saginaw.length] = createMarker(new GPoint(-83.96818800,43.44078600),"
St Helen Elementary School
2415 N Charles Street
Saginaw, MI 48602
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Helen Elementary School",'Saginaw=' + Saginaw.length); Hemlock[Hemlock.length] = createMarker(new GPoint(-84.20065900,43.38931100),"
St Johns Lutheran School
2290 Pretzer Road
Hemlock, MI 48626
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Johns Lutheran School",'Hemlock=' + Hemlock.length); Saginaw[Saginaw.length] = createMarker(new GPoint(-83.97618300,43.43556300),"
St Pauls Lutheran School
2745 W Genesee Avenue
Saginaw, MI 48602
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Pauls Lutheran School",'Saginaw=' + Saginaw.length); Saginaw[Saginaw.length] = createMarker(new GPoint(-83.98869700,43.42633400),"
St Stephen Catholic School
1300 Malzahn Street
Saginaw, MI 48602
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Stephen Catholic School",'Saginaw=' + Saginaw.length); Saginaw[Saginaw.length] = createMarker(new GPoint(-83.99050000,43.49394200),"
Tri-City SDA School
3955 Kochville Road
Saginaw, MI 48604
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Tri-City SDA School",'Saginaw=' + Saginaw.length); Hemlock[Hemlock.length] = createMarker(new GPoint(-84.26763100,43.46336700),"
Zion Lutheran School
17903 Dice Rd
Hemlock, MI 48626
Co-ed school, PK-3
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Zion Lutheran School",'Hemlock=' + Hemlock.length); Chesaning[Chesaning.length] = createMarker(new GPoint(-84.10732600,43.18606300),"
Zion Lutheran School
796 Hampton Street
Chesaning, MI 48616
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Zion Lutheran School",'Chesaning=' + Chesaning.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(Bridgeport); map.removeOverlays(Chesaning); map.removeOverlays(Frankenmuth); map.removeOverlays(Hemlock); map.removeOverlays(Oakley); map.removeOverlays(Reese); map.removeOverlays(Saginaw); 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(Saginaw);map.removeOverlays(Bridgeport); map.removeOverlays(Chesaning); map.removeOverlays(Frankenmuth); map.removeOverlays(Hemlock); map.removeOverlays(Oakley); map.removeOverlays(Reese); map.removeOverlays(Saginaw); map.addOverlays(Bridgeport); centerByArray(Bridgeport, false, false); cntMarker += Bridgeport.length; map.addOverlays(Chesaning); centerByArray(Chesaning, false, false); cntMarker += Chesaning.length; map.addOverlays(Frankenmuth); centerByArray(Frankenmuth, false, false); cntMarker += Frankenmuth.length; map.addOverlays(Hemlock); centerByArray(Hemlock, false, false); cntMarker += Hemlock.length; map.addOverlays(Oakley); centerByArray(Oakley, false, false); cntMarker += Oakley.length; map.addOverlays(Reese); centerByArray(Reese, false, false); cntMarker += Reese.length; map.addOverlays(Saginaw); centerByArray(Saginaw, false, false); cntMarker += Saginaw.length; centerByArray(Saginaw,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; }