function addMarkers(){ mySelect = document.getElementById('selection'); Benton_Harbor = [];Stevensville = [];Eau_Claire = [];Coloma = [];Watervliet = [];Saint_Joseph = [];Bridgman = [];Buchanan = [];Niles = [];Berrien_Springs = [];New_Buffalo = [];Sodus = [];Sawyer = [];mySelect.options[mySelect.options.length] = new Option("Benton Harbor schools",'all=Benton_Harbor'); mySelect.options[mySelect.options.length] = new Option("Berrien Springs schools",'all=Berrien_Springs'); mySelect.options[mySelect.options.length] = new Option("Bridgman schools",'all=Bridgman'); mySelect.options[mySelect.options.length] = new Option("Buchanan schools",'all=Buchanan'); mySelect.options[mySelect.options.length] = new Option("Coloma schools",'all=Coloma'); mySelect.options[mySelect.options.length] = new Option("Eau Claire schools",'all=Eau_Claire'); mySelect.options[mySelect.options.length] = new Option("New Buffalo schools",'all=New_Buffalo'); mySelect.options[mySelect.options.length] = new Option("Niles schools",'all=Niles'); mySelect.options[mySelect.options.length] = new Option("Saint Joseph schools",'all=Saint_Joseph'); mySelect.options[mySelect.options.length] = new Option("Sawyer schools",'all=Sawyer'); mySelect.options[mySelect.options.length] = new Option("Sodus schools",'all=Sodus'); mySelect.options[mySelect.options.length] = new Option("Stevensville schools",'all=Stevensville'); mySelect.options[mySelect.options.length] = new Option("Watervliet schools",'all=Watervliet'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Benton_Harbor[Benton_Harbor.length] = createMarker(new GPoint(-86.44651000,42.06619100),"
Brookview School
501 Zollar Drive
Benton Harbor, MI 49022
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Brookview School",'Benton_Harbor=' + Benton_Harbor.length); Stevensville[Stevensville.length] = createMarker(new GPoint(-86.49463500,42.03882300),"
Christ Lutheran School
4333 Cleveland Avenue
Stevensville, MI 49127
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Christ Lutheran School",'Stevensville=' + Stevensville.length); Eau_Claire[Eau_Claire.length] = createMarker(new GPoint(-86.29912200,42.04302600),"
Eau Claire Sda School
6562 Naomi Road
Eau Claire, MI 49111
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Eau Claire Sda School",'Eau_Claire=' + Eau_Claire.length); Benton_Harbor[Benton_Harbor.length] = createMarker(new GPoint(-86.45730000,42.09346200),"
Edith B. Garrett
140 Seneca Rd.
Benton Harbor, MI 49022
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Edith B. Garrett",'Benton_Harbor=' + Benton_Harbor.length); Coloma[Coloma.length] = createMarker(new GPoint(-86.29447700,42.19316300),"
Faith Lutheran School
6756 Paw Paw Ave
Coloma, MI 49038
Co-ed school, 1-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Faith Lutheran School",'Coloma=' + Coloma.length); Benton_Harbor[Benton_Harbor.length] = createMarker(new GPoint(-86.45101400,42.08249100),"
Good Shepherd Lutheran School
1965 Broadway
Benton Harbor, MI 49022
Co-ed school, K-3
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Good Shepherd Lutheran School",'Benton_Harbor=' + Benton_Harbor.length); Watervliet[Watervliet.length] = createMarker(new GPoint(-86.26171500,42.11919500),"
Grace Christian School
325 N M 140
Watervliet, MI 49098
Co-ed school, NS-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Grace Christian School",'Watervliet=' + Watervliet.length); Saint_Joseph[Saint_Joseph.length] = createMarker(new GPoint(-86.44791900,42.04353200),"
Grace Lutheran School
404 East Glenlord Road
Saint Joseph, MI 49085
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Grace Lutheran School",'Saint_Joseph=' + Saint_Joseph.length); Bridgman[Bridgman.length] = createMarker(new GPoint(-86.56040000,41.94000000),"
Immanuel Lutheran School
Po Box 26 9650 N Church Street
Bridgman, MI 49106
Co-ed school, PK-5
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Immanuel Lutheran School",'Bridgman=' + Bridgman.length); Buchanan[Buchanan.length] = createMarker(new GPoint(-86.37850000,41.83540000),"
Jesus Christ Academy
945 Chippewa Street Po Box 183
Buchanan, MI 49107
Co-ed school, 2-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Jesus Christ Academy",'Buchanan=' + Buchanan.length); Saint_Joseph[Saint_Joseph.length] = createMarker(new GPoint(-86.48491400,42.06013300),"
Lake Michigan Cath. Elementary School
3165 Washington Avenue
Saint Joseph, MI 49085
Co-ed school, PK-5
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Lake Michigan Cath. Elementary School",'Saint_Joseph=' + Saint_Joseph.length); Saint_Joseph[Saint_Joseph.length] = createMarker(new GPoint(-86.47802600,42.10799200),"
Lake Michigan Catholic Schools
915 Pleasant Street
Saint Joseph, MI 49085
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Lake Michigan Catholic Schools",'Saint_Joseph=' + Saint_Joseph.length); Niles[Niles.length] = createMarker(new GPoint(-86.27108300,41.82847200),"
Niles Sda School
110 N Fairview Avenue
Niles, MI 49120
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Niles Sda School",'Niles=' + Niles.length); Berrien_Springs[Berrien_Springs.length] = createMarker(new GPoint(-86.35250000,41.96054000),"
Ruth Murdoch Elementary School
200 Garland Avenue
Berrien Springs, MI 49104
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Ruth Murdoch Elementary School",'Berrien_Springs=' + Berrien_Springs.length); New_Buffalo[New_Buffalo.length] = createMarker(new GPoint(-86.75218100,41.79202300),"
St. Mary Of The Lake School
704 W. Merchant St.
New Buffalo, MI 49117
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Mary Of The Lake School",'New_Buffalo=' + New_Buffalo.length); Stevensville[Stevensville.length] = createMarker(new GPoint(-86.51891800,42.01453700),"
St. Pauls Lutheran School
2673 W John Beers Road
Stevensville, MI 49127
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Pauls Lutheran School",'Stevensville=' + Stevensville.length); Watervliet[Watervliet.length] = createMarker(new GPoint(-86.26259300,42.18363700),"
St Joseph Catholic School
188 Lucinda Lane
Watervliet, MI 49098
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Joseph Catholic School",'Watervliet=' + Watervliet.length); Niles[Niles.length] = createMarker(new GPoint(-86.26357100,41.82485600),"
St Mary School
217 S Lincoln Avenue
Niles, MI 49120
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Mary School",'Niles=' + Niles.length); Benton_Harbor[Benton_Harbor.length] = createMarker(new GPoint(-86.45359000,42.10601200),"
St Matthew S Lutheran School
671 Mcallister Avenue
Benton Harbor, MI 49022
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Matthew S Lutheran School",'Benton_Harbor=' + Benton_Harbor.length); Sodus[Sodus.length] = createMarker(new GPoint(-86.37410000,42.03290000),"
St Paul's Lutheran School
Po Box 68
Sodus, MI 49126
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Paul's Lutheran School",'Sodus=' + Sodus.length); Sawyer[Sawyer.length] = createMarker(new GPoint(-86.59212600,41.88563700),"
Trinity Lutheran School
Po Box 247
Sawyer, MI 49125
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Trinity Lutheran School",'Sawyer=' + Sawyer.length); Berrien_Springs[Berrien_Springs.length] = createMarker(new GPoint(-86.34833300,41.95293700),"
Trinity Lutheran School
9123 George Avenue
Berrien Springs, MI 49103
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Trinity Lutheran School",'Berrien_Springs=' + Berrien_Springs.length); Saint_Joseph[Saint_Joseph.length] = createMarker(new GPoint(-86.48141100,42.10583400),"
Trinity Lutheran School
613 Court Street
Saint Joseph, MI 49085
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Trinity Lutheran School",'Saint_Joseph=' + Saint_Joseph.length); Berrien_Springs[Berrien_Springs.length] = createMarker(new GPoint(-86.34177900,41.94623700),"
Village Sda Elementary School
409 W Mars Street
Berrien Springs, MI 49103
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Village Sda Elementary School",'Berrien_Springs=' + Berrien_Springs.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(Benton_Harbor); map.removeOverlays(Berrien_Springs); map.removeOverlays(Bridgman); map.removeOverlays(Buchanan); map.removeOverlays(Coloma); map.removeOverlays(Eau_Claire); map.removeOverlays(New_Buffalo); map.removeOverlays(Niles); map.removeOverlays(Saint_Joseph); map.removeOverlays(Sawyer); map.removeOverlays(Sodus); map.removeOverlays(Stevensville); map.removeOverlays(Watervliet); 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(Benton_Harbor);map.removeOverlays(Benton_Harbor); map.removeOverlays(Berrien_Springs); map.removeOverlays(Bridgman); map.removeOverlays(Buchanan); map.removeOverlays(Coloma); map.removeOverlays(Eau_Claire); map.removeOverlays(New_Buffalo); map.removeOverlays(Niles); map.removeOverlays(Saint_Joseph); map.removeOverlays(Sawyer); map.removeOverlays(Sodus); map.removeOverlays(Stevensville); map.removeOverlays(Watervliet); map.addOverlays(Benton_Harbor); centerByArray(Benton_Harbor, false, false); cntMarker += Benton_Harbor.length; map.addOverlays(Berrien_Springs); centerByArray(Berrien_Springs, false, false); cntMarker += Berrien_Springs.length; map.addOverlays(Bridgman); centerByArray(Bridgman, false, false); cntMarker += Bridgman.length; map.addOverlays(Buchanan); centerByArray(Buchanan, false, false); cntMarker += Buchanan.length; map.addOverlays(Coloma); centerByArray(Coloma, false, false); cntMarker += Coloma.length; map.addOverlays(Eau_Claire); centerByArray(Eau_Claire, false, false); cntMarker += Eau_Claire.length; map.addOverlays(New_Buffalo); centerByArray(New_Buffalo, false, false); cntMarker += New_Buffalo.length; map.addOverlays(Niles); centerByArray(Niles, false, false); cntMarker += Niles.length; map.addOverlays(Saint_Joseph); centerByArray(Saint_Joseph, false, false); cntMarker += Saint_Joseph.length; map.addOverlays(Sawyer); centerByArray(Sawyer, false, false); cntMarker += Sawyer.length; map.addOverlays(Sodus); centerByArray(Sodus, false, false); cntMarker += Sodus.length; map.addOverlays(Stevensville); centerByArray(Stevensville, false, false); cntMarker += Stevensville.length; map.addOverlays(Watervliet); centerByArray(Watervliet, false, false); cntMarker += Watervliet.length; centerByArray(Benton_Harbor,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; }