function addMarkers(){ mySelect = document.getElementById('selection'); Crystal_Lake = [];Harvard = [];Woodstock = [];Algonquin = [];Mchenry = [];Cary = [];Johnsburg = [];Marengo = [];mySelect.options[mySelect.options.length] = new Option("Algonquin schools",'all=Algonquin'); mySelect.options[mySelect.options.length] = new Option("Cary schools",'all=Cary'); mySelect.options[mySelect.options.length] = new Option("Crystal Lake schools",'all=Crystal_Lake'); mySelect.options[mySelect.options.length] = new Option("Harvard schools",'all=Harvard'); mySelect.options[mySelect.options.length] = new Option("Johnsburg schools",'all=Johnsburg'); mySelect.options[mySelect.options.length] = new Option("Marengo schools",'all=Marengo'); mySelect.options[mySelect.options.length] = new Option("Mchenry schools",'all=Mchenry'); mySelect.options[mySelect.options.length] = new Option("Woodstock schools",'all=Woodstock'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Crystal_Lake[Crystal_Lake.length] = createMarker(new GPoint(-88.31610000,42.24110000),"
Beginnings Montessori School
3419 Walkup Road
Crystal Lake, IL 60012
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Beginnings Montessori School",'Crystal_Lake=' + Crystal_Lake.length); Harvard[Harvard.length] = createMarker(new GPoint(-88.60808800,42.44138200),"
Bright Horizons Of Motorola Ha
2001 N. Division
Harvard, IL 60033
Co-ed school, PK-KG
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bright Horizons Of Motorola Ha",'Harvard=' + Harvard.length); Crystal_Lake[Crystal_Lake.length] = createMarker(new GPoint(-88.33798500,42.23394700),"
Childrens House Montessori
461 Pierson St
Crystal Lake, IL 60014
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Childrens House Montessori",'Crystal_Lake=' + Crystal_Lake.length); Woodstock[Woodstock.length] = createMarker(new GPoint(-88.43695800,42.32253900),"
Community Montessori
640 Mchenry Avenue
Woodstock, IL 60098
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Community Montessori",'Woodstock=' + Woodstock.length); Woodstock[Woodstock.length] = createMarker(new GPoint(-88.37241700,42.28488200),"
Crystal Lake Montessori School
3013 Country Club Rd.
Woodstock, IL 60098
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Crystal Lake Montessori School",'Woodstock=' + Woodstock.length); Algonquin[Algonquin.length] = createMarker(new GPoint(-88.33954700,42.17556900),"
Foundations Montessori School
2651 W Algonquin Road
Algonquin, IL 60102
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Foundations Montessori School",'Algonquin=' + Algonquin.length); Mchenry[Mchenry.length] = createMarker(new GPoint(-88.27469500,42.33495700),"
Fox Valley Christian School
509 Front Street
Mchenry, IL 60050
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Fox Valley Christian School",'Mchenry=' + Mchenry.length); Crystal_Lake[Crystal_Lake.length] = createMarker(new GPoint(-88.33070000,42.22640000),"
Greentree At Crystal Lake
Po Box 307 290 Memorial Court
Crystal Lake, IL 60014
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Greentree At Crystal Lake",'Crystal_Lake=' + Crystal_Lake.length); Crystal_Lake[Crystal_Lake.length] = createMarker(new GPoint(-88.32928100,42.23628800),"
Immanuel Lutheran School
178 Mchenry Avenue
Crystal Lake, IL 60014
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Immanuel Lutheran School",'Crystal_Lake=' + Crystal_Lake.length); Algonquin[Algonquin.length] = createMarker(new GPoint(-88.33324800,42.17027200),"
Kindercare Learning Center
501 Rolls Drive
Algonquin, IL 60102
Co-ed school, PK-1
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Kindercare Learning Center",'Algonquin=' + Algonquin.length); Crystal_Lake[Crystal_Lake.length] = createMarker(new GPoint(-88.32115000,42.21952900),"
Kindercare Learning Center
14 Berkshire Drive
Crystal Lake, IL 60014
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Kindercare Learning Center",'Crystal_Lake=' + Crystal_Lake.length); Cary[Cary.length] = createMarker(new GPoint(-88.24516300,42.21142600),"
Kindercare Learning Center
324 Crystal Street
Cary, IL 60013
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Kindercare Learning Center",'Cary=' + Cary.length); Crystal_Lake[Crystal_Lake.length] = createMarker(new GPoint(-88.29811100,42.25025000),"
Kindercare Learning Centers, Inc.
645 Dakota Street
Crystal Lake, IL 60012
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Kindercare Learning Centers, Inc.",'Crystal_Lake=' + Crystal_Lake.length); Crystal_Lake[Crystal_Lake.length] = createMarker(new GPoint(-88.37791700,42.26778600),"
Lord And Savior Lutheran School
9300 Ridgefield Road
Crystal Lake, IL 60012
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Lord And Savior Lutheran School",'Crystal_Lake=' + Crystal_Lake.length); Mchenry[Mchenry.length] = createMarker(new GPoint(-88.29963900,42.35020300),"
Mchenry Montessori School
5213 W Elm Street
Mchenry, IL 60050
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mchenry Montessori School",'Mchenry=' + Mchenry.length); Crystal_Lake[Crystal_Lake.length] = createMarker(new GPoint(-88.33090000,42.22737100),"
Montessori Pathways School
133 Illinoise St
Crystal Lake, IL 60014
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Montessori Pathways School",'Crystal_Lake=' + Crystal_Lake.length); Mchenry[Mchenry.length] = createMarker(new GPoint(-88.26756100,42.34803100),"
Montini Catholic School
1405 N Richmond Road
Mchenry, IL 60050
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Montini Catholic School",'Mchenry=' + Mchenry.length); Mchenry[Mchenry.length] = createMarker(new GPoint(-88.20693100,42.40853700),"
Progressive Path School
510 W Broadway St
Mchenry, IL 60050
Co-ed school, PK-1
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Progressive Path School",'Mchenry=' + Mchenry.length); Algonquin[Algonquin.length] = createMarker(new GPoint(-88.28883200,42.16393600),"
St. Margaret Mary School
119 S Hubbard Street
Algonquin, IL 60102
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Margaret Mary School",'Algonquin=' + Algonquin.length); Woodstock[Woodstock.length] = createMarker(new GPoint(-88.45028500,42.31716200),"
St. Mary Catholic School
313 N Tryon Street
Woodstock, IL 60098
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Mary Catholic School",'Woodstock=' + Woodstock.length); Crystal_Lake[Crystal_Lake.length] = createMarker(new GPoint(-88.33723500,42.23347800),"
St. Thomas The Apostle School
265 King Street
Crystal Lake, IL 60014
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Thomas The Apostle School",'Crystal_Lake=' + Crystal_Lake.length); Cary[Cary.length] = createMarker(new GPoint(-88.23847500,42.21349300),"
Ss Peter & Paul Elementary School
416 1st Street
Cary, IL 60013
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Ss Peter & Paul Elementary School",'Cary=' + Cary.length); Johnsburg[Johnsburg.length] = createMarker(new GPoint(-88.24359900,42.38273700),"
St John The Baptist Catholic School
2304 Church Street
Johnsburg, IL 60050
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St John The Baptist Catholic School",'Johnsburg=' + Johnsburg.length); Algonquin[Algonquin.length] = createMarker(new GPoint(-88.29506100,42.16609100),"
St Johns Lutheran School
300 Jefferson Street
Algonquin, IL 60102
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Johns Lutheran School",'Algonquin=' + Algonquin.length); Harvard[Harvard.length] = createMarker(new GPoint(-88.61331300,42.41884300),"
St Josephs School
201 N Division Street
Harvard, IL 60033
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Josephs School",'Harvard=' + Harvard.length); Cary[Cary.length] = createMarker(new GPoint(-88.23806600,42.21361600),"
Trinity Oaks Christian Academy
409 N First Street
Cary, IL 60013
Co-ed school, NS-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Trinity Oaks Christian Academy",'Cary=' + Cary.length); Woodstock[Woodstock.length] = createMarker(new GPoint(-88.45251700,42.30384800),"
Woodstock Christian School
1201 Dean Street
Woodstock, IL 60098
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Woodstock Christian School",'Woodstock=' + Woodstock.length); Marengo[Marengo.length] = createMarker(new GPoint(-88.60454600,42.25263700),"
Zion Lutheran School
408 Jackson Street
Marengo, IL 60152
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Zion Lutheran School",'Marengo=' + Marengo.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(Algonquin); map.removeOverlays(Cary); map.removeOverlays(Crystal_Lake); map.removeOverlays(Harvard); map.removeOverlays(Johnsburg); map.removeOverlays(Marengo); map.removeOverlays(Mchenry); map.removeOverlays(Woodstock); 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(Crystal_Lake);map.removeOverlays(Algonquin); map.removeOverlays(Cary); map.removeOverlays(Crystal_Lake); map.removeOverlays(Harvard); map.removeOverlays(Johnsburg); map.removeOverlays(Marengo); map.removeOverlays(Mchenry); map.removeOverlays(Woodstock); map.addOverlays(Algonquin); centerByArray(Algonquin, false, false); cntMarker += Algonquin.length; map.addOverlays(Cary); centerByArray(Cary, false, false); cntMarker += Cary.length; map.addOverlays(Crystal_Lake); centerByArray(Crystal_Lake, false, false); cntMarker += Crystal_Lake.length; map.addOverlays(Harvard); centerByArray(Harvard, false, false); cntMarker += Harvard.length; map.addOverlays(Johnsburg); centerByArray(Johnsburg, false, false); cntMarker += Johnsburg.length; map.addOverlays(Marengo); centerByArray(Marengo, false, false); cntMarker += Marengo.length; map.addOverlays(Mchenry); centerByArray(Mchenry, false, false); cntMarker += Mchenry.length; map.addOverlays(Woodstock); centerByArray(Woodstock, false, false); cntMarker += Woodstock.length; centerByArray(Crystal_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; }