function addMarkers(){ mySelect = document.getElementById('selection'); Port_Huron = [];Eastpointe = [];Clarkston = [];Utica = [];Milford = [];Livonia = [];Rockwood = [];Flint = [];Grosse_Pointe = [];Clawson = [];Saginaw = [];Grand_Rapids = [];Washington = [];Glen_Arbor = [];Union_City = [];Morenci = [];Lincoln_Park = [];Petoskey = [];Scottville = [];Marshall = [];New_Buffalo = [];Detroit = [];mySelect.options[mySelect.options.length] = new Option("Clarkston schools",'all=Clarkston'); mySelect.options[mySelect.options.length] = new Option("Clawson schools",'all=Clawson'); mySelect.options[mySelect.options.length] = new Option("Detroit schools",'all=Detroit'); mySelect.options[mySelect.options.length] = new Option("Eastpointe schools",'all=Eastpointe'); mySelect.options[mySelect.options.length] = new Option("Flint schools",'all=Flint'); mySelect.options[mySelect.options.length] = new Option("Glen Arbor schools",'all=Glen_Arbor'); mySelect.options[mySelect.options.length] = new Option("Grand Rapids schools",'all=Grand_Rapids'); mySelect.options[mySelect.options.length] = new Option("Grosse Pointe schools",'all=Grosse_Pointe'); mySelect.options[mySelect.options.length] = new Option("Lincoln Park schools",'all=Lincoln_Park'); mySelect.options[mySelect.options.length] = new Option("Livonia schools",'all=Livonia'); mySelect.options[mySelect.options.length] = new Option("Marshall schools",'all=Marshall'); mySelect.options[mySelect.options.length] = new Option("Milford schools",'all=Milford'); mySelect.options[mySelect.options.length] = new Option("Morenci schools",'all=Morenci'); mySelect.options[mySelect.options.length] = new Option("New Buffalo schools",'all=New_Buffalo'); mySelect.options[mySelect.options.length] = new Option("Petoskey schools",'all=Petoskey'); mySelect.options[mySelect.options.length] = new Option("Port Huron schools",'all=Port_Huron'); mySelect.options[mySelect.options.length] = new Option("Rockwood schools",'all=Rockwood'); mySelect.options[mySelect.options.length] = new Option("Saginaw schools",'all=Saginaw'); mySelect.options[mySelect.options.length] = new Option("Scottville schools",'all=Scottville'); mySelect.options[mySelect.options.length] = new Option("Union City schools",'all=Union_City'); mySelect.options[mySelect.options.length] = new Option("Utica schools",'all=Utica'); mySelect.options[mySelect.options.length] = new Option("Washington schools",'all=Washington'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Port_Huron[Port_Huron.length] = createMarker(new GPoint(-82.45436200,42.94451800),"
Anthonita Montessori Academy
2625 Moak Street
Port Huron, MI 48060
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Anthonita Montessori Academy",'Port_Huron=' + Port_Huron.length); Eastpointe[Eastpointe.length] = createMarker(new GPoint(-82.92570200,42.46462200),"
B & E Childcare/barbara Serian
22616 Petersburg
Eastpointe, MI 48021
Co-ed school, PK-KG
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("B & E Childcare/barbara Serian",'Eastpointe=' + Eastpointe.length); Clarkston[Clarkston.length] = createMarker(new GPoint(-83.46734700,42.74683700),"
Cedar Crest Academy
8970 Dixie Highway
Clarkston, MI 48348
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Cedar Crest Academy",'Clarkston=' + Clarkston.length); Utica[Utica.length] = createMarker(new GPoint(-82.99380400,42.63256300),"
Childrens World Learning Center
45900 Northpointe Bd
Utica, MI 48315
Co-ed school, PK-KG
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Childrens World Learning Center",'Utica=' + Utica.length); Milford[Milford.length] = createMarker(new GPoint(-83.60809300,42.58395700),"
Christ Lutheran Preschool And
620 General Motors
Milford, MI 48381
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Christ Lutheran Preschool And",'Milford=' + Milford.length); Livonia[Livonia.length] = createMarker(new GPoint(-83.37328500,42.38613900),"
Christ Our Savior Early Childh
14175 Farmington Rd
Livonia, MI 48154
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Christ Our Savior Early Childh",'Livonia=' + Livonia.length); Rockwood[Rockwood.length] = createMarker(new GPoint(-83.24587900,42.07258900),"
First Step Children Center Inc
32211 Fort St
Rockwood, MI 48173
Co-ed school, KG-KG
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("First Step Children Center Inc",'Rockwood=' + Rockwood.length); Flint[Flint.length] = createMarker(new GPoint(-83.71256900,43.06733700),"
Flint Islamic Pre-school/doren
614 W Home Ave
Flint, MI 48505
Co-ed school, PK-KG
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Flint Islamic Pre-school/doren",'Flint=' + Flint.length); Grosse_Pointe[Grosse_Pointe.length] = createMarker(new GPoint(-82.89934600,42.38724800),"
Foundations For Exceptional Children
16 Lake Shore Drive
Grosse Pointe, MI 48236
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Foundations For Exceptional Children",'Grosse_Pointe=' + Grosse_Pointe.length); Clawson[Clawson.length] = createMarker(new GPoint(-83.13951700,42.53346300),"
Gateway Country Day
456 E Fourteen Mile
Clawson, MI 48017
Co-ed school, PK-KG
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Gateway Country Day",'Clawson=' + Clawson.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); Grand_Rapids[Grand_Rapids.length] = createMarker(new GPoint(-85.62674900,42.89466100),"
Kentwood Christian Children's
3765 Kalamazoo Ave. Se
Grand Rapids, MI 49508
Co-ed school, PK-KG
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Kentwood Christian Children's",'Grand_Rapids=' + Grand_Rapids.length); Washington[Washington.length] = createMarker(new GPoint(-83.03625100,42.72828800),"
Krambrooke-Griffin Academy and Child Development Center (KGA)
59027 Van Dyke
Washington, MI 48094
Co-ed school, NS-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Krambrooke-Griffin Academy and Child Development Center (KGA)",'Washington=' + Washington.length); Glen_Arbor[Glen_Arbor.length] = createMarker(new GPoint(-85.97070500,44.90864000),"
The Leelanau School
1 Old Homestead Road
Glen Arbor, MI 49636
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The Leelanau School",'Glen_Arbor=' + Glen_Arbor.length); Union_City[Union_City.length] = createMarker(new GPoint(-85.13851400,42.06147400),"
Little Lights Preschool
205 South Street
Union City, MI 49094
Co-ed school, Ungraded
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Little Lights Preschool",'Union_City=' + Union_City.length); Morenci[Morenci.length] = createMarker(new GPoint(-84.21521500,41.72049400),"
Little People's Place
210 North Summit Street
Morenci, MI 49256
Co-ed school, PK-KG
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Little People's Place",'Morenci=' + Morenci.length); Lincoln_Park[Lincoln_Park.length] = createMarker(new GPoint(-83.18569500,42.22473700),"
Meadowbank School
1584 Goddard Road
Lincoln Park, MI 48146
Co-ed school, PK-2
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Meadowbank School",'Lincoln_Park=' + Lincoln_Park.length); Lincoln_Park[Lincoln_Park.length] = createMarker(new GPoint(-83.18569500,42.22473700),"
Meadowbank Schools
1584 Goddard
Lincoln Park, MI 48146
Co-ed school, PK-2
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Meadowbank Schools",'Lincoln_Park=' + Lincoln_Park.length); Petoskey[Petoskey.length] = createMarker(new GPoint(-84.96929400,45.37340100),"
Northern Migh Comm Child Dev C
416 Connable Ave
Petoskey, MI 49770
Co-ed school, PK-KG
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Northern Migh Comm Child Dev C",'Petoskey=' + Petoskey.length); Scottville[Scottville.length] = createMarker(new GPoint(-86.29180000,43.95560000),"
Our Savior Lutheran Ps & K
Po Box 132
Scottville, MI 49454
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Our Savior Lutheran Ps & K",'Scottville=' + Scottville.length); Marshall[Marshall.length] = createMarker(new GPoint(-84.96138600,42.27313700),"
Presbyterian Center For Children
200 W Mansion
Marshall, MI 49068
Co-ed school, PK-5
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Presbyterian Center For Children",'Marshall=' + Marshall.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); Detroit[Detroit.length] = createMarker(new GPoint(-83.04441300,42.41501600),"
Transfiguration Academy
13300 Syracuse
Detroit, MI 48212
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Transfiguration Academy",'Detroit=' + Detroit.length); map.removeOverlays(Clarkston); map.removeOverlays(Clawson); map.removeOverlays(Detroit); map.removeOverlays(Eastpointe); map.removeOverlays(Flint); map.removeOverlays(Glen_Arbor); map.removeOverlays(Grand_Rapids); map.removeOverlays(Grosse_Pointe); map.removeOverlays(Lincoln_Park); map.removeOverlays(Livonia); map.removeOverlays(Marshall); map.removeOverlays(Milford); map.removeOverlays(Morenci); map.removeOverlays(New_Buffalo); map.removeOverlays(Petoskey); map.removeOverlays(Port_Huron); map.removeOverlays(Rockwood); map.removeOverlays(Saginaw); map.removeOverlays(Scottville); map.removeOverlays(Union_City); map.removeOverlays(Utica); map.removeOverlays(Washington); setTimeout(function(){map.addOverlays(Clarkston)},1000); setTimeout(function(){map.addOverlays(Clawson)},1000); setTimeout(function(){map.addOverlays(Detroit)},1000); setTimeout(function(){map.addOverlays(Eastpointe)},1000); setTimeout(function(){map.addOverlays(Flint)},1000); setTimeout(function(){map.addOverlays(Glen_Arbor)},1000); setTimeout(function(){map.addOverlays(Grand_Rapids)},1000); setTimeout(function(){map.addOverlays(Grosse_Pointe)},1000); setTimeout(function(){map.addOverlays(Lincoln_Park)},1000); setTimeout(function(){map.addOverlays(Livonia)},1000); setTimeout(function(){map.addOverlays(Marshall)},1000); setTimeout(function(){map.addOverlays(Milford)},1000); setTimeout(function(){map.addOverlays(Morenci)},1000); setTimeout(function(){map.addOverlays(New_Buffalo)},1000); setTimeout(function(){map.addOverlays(Petoskey)},1000); setTimeout(function(){map.addOverlays(Port_Huron)},1000); setTimeout(function(){map.addOverlays(Rockwood)},1000); setTimeout(function(){map.addOverlays(Saginaw)},1000); setTimeout(function(){map.addOverlays(Scottville)},1000); setTimeout(function(){map.addOverlays(Union_City)},1000); setTimeout(function(){map.addOverlays(Utica)},1000); setTimeout(function(){map.addOverlays(Washington)},1000); maxLng = -82.45436200; maxLat = 45.37340100; minLng = -86.75218100; minLat = 41.72049400; reCenterMap(); } // 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//////' + showArray); map.removeOverlays(Clarkston); map.removeOverlays(Clawson); map.removeOverlays(Detroit); map.removeOverlays(Eastpointe); map.removeOverlays(Flint); map.removeOverlays(Glen_Arbor); map.removeOverlays(Grand_Rapids); map.removeOverlays(Grosse_Pointe); map.removeOverlays(Lincoln_Park); map.removeOverlays(Livonia); map.removeOverlays(Marshall); map.removeOverlays(Milford); map.removeOverlays(Morenci); map.removeOverlays(New_Buffalo); map.removeOverlays(Petoskey); map.removeOverlays(Port_Huron); map.removeOverlays(Rockwood); map.removeOverlays(Saginaw); map.removeOverlays(Scottville); map.removeOverlays(Union_City); map.removeOverlays(Utica); map.removeOverlays(Washington); 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(Port_Huron);map.removeOverlays(Clarkston); map.removeOverlays(Clawson); map.removeOverlays(Detroit); map.removeOverlays(Eastpointe); map.removeOverlays(Flint); map.removeOverlays(Glen_Arbor); map.removeOverlays(Grand_Rapids); map.removeOverlays(Grosse_Pointe); map.removeOverlays(Lincoln_Park); map.removeOverlays(Livonia); map.removeOverlays(Marshall); map.removeOverlays(Milford); map.removeOverlays(Morenci); map.removeOverlays(New_Buffalo); map.removeOverlays(Petoskey); map.removeOverlays(Port_Huron); map.removeOverlays(Rockwood); map.removeOverlays(Saginaw); map.removeOverlays(Scottville); map.removeOverlays(Union_City); map.removeOverlays(Utica); map.removeOverlays(Washington); map.addOverlays(Clarkston); centerByArray(Clarkston, false, false); cntMarker += Clarkston.length; map.addOverlays(Clawson); centerByArray(Clawson, false, false); cntMarker += Clawson.length; map.addOverlays(Detroit); centerByArray(Detroit, false, false); cntMarker += Detroit.length; map.addOverlays(Eastpointe); centerByArray(Eastpointe, false, false); cntMarker += Eastpointe.length; map.addOverlays(Flint); centerByArray(Flint, false, false); cntMarker += Flint.length; map.addOverlays(Glen_Arbor); centerByArray(Glen_Arbor, false, false); cntMarker += Glen_Arbor.length; map.addOverlays(Grand_Rapids); centerByArray(Grand_Rapids, false, false); cntMarker += Grand_Rapids.length; map.addOverlays(Grosse_Pointe); centerByArray(Grosse_Pointe, false, false); cntMarker += Grosse_Pointe.length; map.addOverlays(Lincoln_Park); centerByArray(Lincoln_Park, false, false); cntMarker += Lincoln_Park.length; map.addOverlays(Livonia); centerByArray(Livonia, false, false); cntMarker += Livonia.length; map.addOverlays(Marshall); centerByArray(Marshall, false, false); cntMarker += Marshall.length; map.addOverlays(Milford); centerByArray(Milford, false, false); cntMarker += Milford.length; map.addOverlays(Morenci); centerByArray(Morenci, false, false); cntMarker += Morenci.length; map.addOverlays(New_Buffalo); centerByArray(New_Buffalo, false, false); cntMarker += New_Buffalo.length; map.addOverlays(Petoskey); centerByArray(Petoskey, false, false); cntMarker += Petoskey.length; map.addOverlays(Port_Huron); centerByArray(Port_Huron, false, false); cntMarker += Port_Huron.length; map.addOverlays(Rockwood); centerByArray(Rockwood, false, false); cntMarker += Rockwood.length; map.addOverlays(Saginaw); centerByArray(Saginaw, false, false); cntMarker += Saginaw.length; map.addOverlays(Scottville); centerByArray(Scottville, false, false); cntMarker += Scottville.length; map.addOverlays(Union_City); centerByArray(Union_City, false, false); cntMarker += Union_City.length; map.addOverlays(Utica); centerByArray(Utica, false, false); cntMarker += Utica.length; map.addOverlays(Washington); centerByArray(Washington, false, false); cntMarker += Washington.length; centerByArray(Port_Huron,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///14595,13721,14736,14726,13819,14708,14603,14681,13933,14721,13721,14133,13714,13835,14758,14691,14105,14473,14751,14679,14704,14713,14247,14736,14690,14726,/all'); //window.open('/map.php?type=2&schools=14595,13721,14736,14726,13819,14708,14603,14681,13933,14721,13721,14133,13714,13835,14758,14691,14105,14473,14751,14679,14704,14713,14247,14736,14690,14726,&school_level=&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; }