function addMarkers(){ mySelect = document.getElementById('selection'); Whitmore_Lake = [];Hartland = [];Brighton = [];Fowlerville = [];Howell = [];Lakeland = [];Pinckney = [];mySelect.options[mySelect.options.length] = new Option("Brighton schools",'all=Brighton'); mySelect.options[mySelect.options.length] = new Option("Fowlerville schools",'all=Fowlerville'); mySelect.options[mySelect.options.length] = new Option("Hartland schools",'all=Hartland'); mySelect.options[mySelect.options.length] = new Option("Howell schools",'all=Howell'); mySelect.options[mySelect.options.length] = new Option("Lakeland schools",'all=Lakeland'); mySelect.options[mySelect.options.length] = new Option("Pinckney schools",'all=Pinckney'); mySelect.options[mySelect.options.length] = new Option("Whitmore Lake schools",'all=Whitmore_Lake'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Whitmore_Lake[Whitmore_Lake.length] = createMarker(new GPoint(-83.75857800,42.43506100),"
Agnus Dei Academy
11648 N Main Street
Whitmore Lake, MI 48189
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Agnus Dei Academy",'Whitmore_Lake=' + Whitmore_Lake.length); Hartland[Hartland.length] = createMarker(new GPoint(-83.70070200,42.65373000),"
Child Of Christ Lutheran School
3375 Fenton Road
Hartland, MI 48353
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Child Of Christ Lutheran School",'Hartland=' + Hartland.length); Brighton[Brighton.length] = createMarker(new GPoint(-83.76218400,42.55221700),"
Cornerstone Christian School
9455 Hilton Road
Brighton, MI 48114
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Cornerstone Christian School",'Brighton=' + Brighton.length); Fowlerville[Fowlerville.length] = createMarker(new GPoint(-84.10180300,42.66278900),"
Fowlerville Christian School
9430 W Grand River Road
Fowlerville, MI 48836
Co-ed school, 1-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Fowlerville Christian School",'Fowlerville=' + Fowlerville.length); Howell[Howell.length] = createMarker(new GPoint(-83.87756400,42.68641200),"
Hidden Springs Christian School
5860 N Latson Road
Howell, MI 48855
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Hidden Springs Christian School",'Howell=' + Howell.length); Brighton[Brighton.length] = createMarker(new GPoint(-83.77534300,42.46239600),"
Holy Spirit Roman Catholic School
9565 Musch Road
Brighton, MI 48116
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Holy Spirit Roman Catholic School",'Brighton=' + Brighton.length); Lakeland[Lakeland.length] = createMarker(new GPoint(-83.84410000,42.46330000),"
Lakeland Montessori School
Po Box 627
Lakeland, MI 48143
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Lakeland Montessori School",'Lakeland=' + Lakeland.length); Pinckney[Pinckney.length] = createMarker(new GPoint(-83.91223400,42.46060100),"
Light Of The World Academy
1740 E M36
Pinckney, MI 48169
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Light Of The World Academy",'Pinckney=' + Pinckney.length); Pinckney[Pinckney.length] = createMarker(new GPoint(-83.94121300,42.45952100),"
Livingston Christian School
550 E. Hamburg Street
Pinckney, MI 48169
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Livingston Christian School",'Pinckney=' + Pinckney.length); Brighton[Brighton.length] = createMarker(new GPoint(-83.76432200,42.52719000),"
Livingston Montessori
5291 Ethel Street
Brighton, MI 48116
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Livingston Montessori",'Brighton=' + Brighton.length); Brighton[Brighton.length] = createMarker(new GPoint(-83.75537000,42.56047200),"
Maple Tree Montessori Academy
2944 S. Old US Hwy 23
Brighton, MI 48114
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Maple Tree Montessori Academy",'Brighton=' + Brighton.length); Howell[Howell.length] = createMarker(new GPoint(-83.92403400,42.60289500),"
St. Joseph School
425 E Washington Street
Howell, MI 48843
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Joseph School",'Howell=' + Howell.length); Pinckney[Pinckney.length] = createMarker(new GPoint(-83.93583100,42.44449000),"
St. Mary Catholic School
10601 Dexter Pinckney Road
Pinckney, MI 48169
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Mary Catholic School",'Pinckney=' + Pinckney.length); Brighton[Brighton.length] = createMarker(new GPoint(-83.79435600,42.57083800),"
Shepherd Of The Lakes Lutheran School
2101 S Hacker Road
Brighton, MI 48114
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Shepherd Of The Lakes Lutheran School",'Brighton=' + Brighton.length); Brighton[Brighton.length] = createMarker(new GPoint(-83.77715900,42.52352600),"
St Patrick School
710 Rickett Road
Brighton, MI 48116
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Patrick School",'Brighton=' + Brighton.length); Brighton[Brighton.length] = createMarker(new GPoint(-83.76661400,42.50765600),"
Tri-lakes Baptist Christian School
9100 Lee Road
Brighton, MI 48116
Co-ed school, K-5
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Tri-lakes Baptist Christian School",'Brighton=' + Brighton.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(Brighton); map.removeOverlays(Fowlerville); map.removeOverlays(Hartland); map.removeOverlays(Howell); map.removeOverlays(Lakeland); map.removeOverlays(Pinckney); map.removeOverlays(Whitmore_Lake); 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(Whitmore_Lake);map.removeOverlays(Brighton); map.removeOverlays(Fowlerville); map.removeOverlays(Hartland); map.removeOverlays(Howell); map.removeOverlays(Lakeland); map.removeOverlays(Pinckney); map.removeOverlays(Whitmore_Lake); map.addOverlays(Brighton); centerByArray(Brighton, false, false); cntMarker += Brighton.length; map.addOverlays(Fowlerville); centerByArray(Fowlerville, false, false); cntMarker += Fowlerville.length; map.addOverlays(Hartland); centerByArray(Hartland, false, false); cntMarker += Hartland.length; map.addOverlays(Howell); centerByArray(Howell, false, false); cntMarker += Howell.length; map.addOverlays(Lakeland); centerByArray(Lakeland, false, false); cntMarker += Lakeland.length; map.addOverlays(Pinckney); centerByArray(Pinckney, false, false); cntMarker += Pinckney.length; map.addOverlays(Whitmore_Lake); centerByArray(Whitmore_Lake, false, false); cntMarker += Whitmore_Lake.length; centerByArray(Whitmore_Lake,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; }