function addMarkers(){ mySelect = document.getElementById('selection'); Oak_Park = [];Mundelein = [];Northfield = [];Chicago = [];Evanston = [];Rolling_Meadows = [];Oak_Lawn = [];Buffalo_Grove = [];Arlington_Heights = [];mySelect.options[mySelect.options.length] = new Option("Arlington Heights schools",'all=Arlington_Heights'); mySelect.options[mySelect.options.length] = new Option("Buffalo Grove schools",'all=Buffalo_Grove'); mySelect.options[mySelect.options.length] = new Option("Chicago schools",'all=Chicago'); mySelect.options[mySelect.options.length] = new Option("Evanston schools",'all=Evanston'); mySelect.options[mySelect.options.length] = new Option("Mundelein schools",'all=Mundelein'); mySelect.options[mySelect.options.length] = new Option("Northfield schools",'all=Northfield'); mySelect.options[mySelect.options.length] = new Option("Oak Lawn schools",'all=Oak_Lawn'); mySelect.options[mySelect.options.length] = new Option("Oak Park schools",'all=Oak_Park'); mySelect.options[mySelect.options.length] = new Option("Rolling Meadows schools",'all=Rolling_Meadows'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Oak_Park[Oak_Park.length] = createMarker(new GPoint(-87.78941600,41.87416300),"
Ascension Elementary School
601 Van Buren Street
Oak Park, IL 60304
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Ascension Elementary School",'Oak_Park=' + Oak_Park.length); Mundelein[Mundelein.length] = createMarker(new GPoint(-87.98694300,42.27323500),"
Carmel Catholic High School
1 Carmel Parkway
Mundelein, IL 60060
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Carmel Catholic High School",'Mundelein=' + Mundelein.length); Northfield[Northfield.length] = createMarker(new GPoint(-87.79836000,42.10016600),"
Christian Heritage Academy
315 Waukegan Rd
Northfield, IL 60093
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Christian Heritage Academy",'Northfield=' + Northfield.length); Chicago[Chicago.length] = createMarker(new GPoint(-87.60664700,41.80529600),"
Hales Franciscan High School
4930 S Cottage Grove Avenue
Chicago, IL 60615
All-boys school, 9-12
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Hales Franciscan High School",'Chicago=' + Chicago.length); Chicago[Chicago.length] = createMarker(new GPoint(-87.80899700,41.98665600),"
Immaculate Conception School
8739 S Exchange Avenue
Chicago, IL 60617
Co-ed school, K-7
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Immaculate Conception School",'Chicago=' + Chicago.length); Evanston[Evanston.length] = createMarker(new GPoint(-87.68785200,42.03267900),"
Pope John Xxiii
1120 Washington St
Evanston, IL 60202
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Pope John Xxiii",'Evanston=' + Evanston.length); Chicago[Chicago.length] = createMarker(new GPoint(-87.74461300,41.99451300),"
Queen Of All Saints
6230 N Lemont Avenue
Chicago, IL 60646
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Queen Of All Saints",'Chicago=' + Chicago.length); Rolling_Meadows[Rolling_Meadows.length] = createMarker(new GPoint(-88.01723100,42.07040100),"
St. Colette School
3900 Pheasant Drive
Rolling Meadows, IL 60008
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Colette School",'Rolling_Meadows=' + Rolling_Meadows.length); Oak_Lawn[Oak_Lawn.length] = createMarker(new GPoint(-87.72951500,41.71598900),"
St. Germaine School
9735 S Kolin Ave
Oak Lawn, IL 60453
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Germaine School",'Oak_Lawn=' + Oak_Lawn.length); Buffalo_Grove[Buffalo_Grove.length] = createMarker(new GPoint(-87.96279100,42.15421100),"
St. Mary School
50 N Buffalo Grove Road
Buffalo Grove, IL 60089
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Mary School",'Buffalo_Grove=' + Buffalo_Grove.length); Arlington_Heights[Arlington_Heights.length] = createMarker(new GPoint(-87.96728300,42.09536300),"
St. Viator High School
1213 E Oakton Street
Arlington Heights, IL 60004
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Viator High School",'Arlington_Heights=' + Arlington_Heights.length); map.removeOverlays(Arlington_Heights); map.removeOverlays(Buffalo_Grove); map.removeOverlays(Chicago); map.removeOverlays(Evanston); map.removeOverlays(Mundelein); map.removeOverlays(Northfield); map.removeOverlays(Oak_Lawn); map.removeOverlays(Oak_Park); map.removeOverlays(Rolling_Meadows); setTimeout(function(){map.addOverlays(Arlington_Heights)},1000); setTimeout(function(){map.addOverlays(Buffalo_Grove)},1000); setTimeout(function(){map.addOverlays(Chicago)},1000); setTimeout(function(){map.addOverlays(Evanston)},1000); setTimeout(function(){map.addOverlays(Mundelein)},1000); setTimeout(function(){map.addOverlays(Northfield)},1000); setTimeout(function(){map.addOverlays(Oak_Lawn)},1000); setTimeout(function(){map.addOverlays(Oak_Park)},1000); setTimeout(function(){map.addOverlays(Rolling_Meadows)},1000); maxLng = -87.60664700; maxLat = 42.27323500; minLng = -88.01723100; minLat = 41.71598900; 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(Arlington_Heights); map.removeOverlays(Buffalo_Grove); map.removeOverlays(Chicago); map.removeOverlays(Evanston); map.removeOverlays(Mundelein); map.removeOverlays(Northfield); map.removeOverlays(Oak_Lawn); map.removeOverlays(Oak_Park); map.removeOverlays(Rolling_Meadows); 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(Oak_Park);map.removeOverlays(Arlington_Heights); map.removeOverlays(Buffalo_Grove); map.removeOverlays(Chicago); map.removeOverlays(Evanston); map.removeOverlays(Mundelein); map.removeOverlays(Northfield); map.removeOverlays(Oak_Lawn); map.removeOverlays(Oak_Park); map.removeOverlays(Rolling_Meadows); map.addOverlays(Arlington_Heights); centerByArray(Arlington_Heights, false, false); cntMarker += Arlington_Heights.length; map.addOverlays(Buffalo_Grove); centerByArray(Buffalo_Grove, false, false); cntMarker += Buffalo_Grove.length; map.addOverlays(Chicago); centerByArray(Chicago, false, false); cntMarker += Chicago.length; map.addOverlays(Evanston); centerByArray(Evanston, false, false); cntMarker += Evanston.length; map.addOverlays(Mundelein); centerByArray(Mundelein, false, false); cntMarker += Mundelein.length; map.addOverlays(Northfield); centerByArray(Northfield, false, false); cntMarker += Northfield.length; map.addOverlays(Oak_Lawn); centerByArray(Oak_Lawn, false, false); cntMarker += Oak_Lawn.length; map.addOverlays(Oak_Park); centerByArray(Oak_Park, false, false); cntMarker += Oak_Park.length; map.addOverlays(Rolling_Meadows); centerByArray(Rolling_Meadows, false, false); cntMarker += Rolling_Meadows.length; centerByArray(Oak_Park,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///9621,8706,8554,8491,8765,9135,9120,8554,9349,8410,9305,9500,/all'); //window.open('/map.php?type=2&schools=9621,8706,8554,8491,8765,9135,9120,8554,9349,8410,9305,9500,&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; }