function addMarkers(){ mySelect = document.getElementById('selection'); Cedar_Rapids = [];Walker = [];Hiawatha = [];Marion = [];mySelect.options[mySelect.options.length] = new Option("Cedar Rapids schools",'all=Cedar_Rapids'); mySelect.options[mySelect.options.length] = new Option("Hiawatha schools",'all=Hiawatha'); mySelect.options[mySelect.options.length] = new Option("Marion schools",'all=Marion'); mySelect.options[mySelect.options.length] = new Option("Walker schools",'all=Walker'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Cedar_Rapids[Cedar_Rapids.length] = createMarker(new GPoint(-91.62557500,41.97856300),"
All Saints School
720 29th Street Se
Cedar Rapids, IA 52403
Co-ed school, K-5
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("All Saints School",'Cedar_Rapids=' + Cedar_Rapids.length); Cedar_Rapids[Cedar_Rapids.length] = createMarker(new GPoint(-91.61524100,41.99526800),"
Cedar Valley Christian School
3636 Cottage Grove Ave Se
Cedar Rapids, IA 52403
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Cedar Valley Christian School",'Cedar_Rapids=' + Cedar_Rapids.length); Walker[Walker.length] = createMarker(new GPoint(-91.77397200,42.31642500),"
Cono Christian School
3269 Quaseweton Ave
Walker, IA 52352
Co-ed school, NS-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Cono Christian School",'Walker=' + Walker.length); Hiawatha[Hiawatha.length] = createMarker(new GPoint(-91.68926700,42.03498100),"
Essential Montessori
1350 Blairs Ferry Road Suite A
Hiawatha, IA 52233
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Essential Montessori",'Hiawatha=' + Hiawatha.length); Cedar_Rapids[Cedar_Rapids.length] = createMarker(new GPoint(-91.68405100,42.02183700),"
Good Shepherd Lutheran School
2900 42nd Street Ne
Cedar Rapids, IA 52402
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Good Shepherd Lutheran School",'Cedar_Rapids=' + Cedar_Rapids.length); Marion[Marion.length] = createMarker(new GPoint(-91.59923100,42.01571900),"
Grace Baptist Academy
1461 E Post Road
Marion, IA 52302
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Grace Baptist Academy",'Marion=' + Marion.length); Cedar_Rapids[Cedar_Rapids.length] = createMarker(new GPoint(-91.65196200,42.02276300),"
Holloway House
1147 Clifton Street Ne
Cedar Rapids, IA 52402
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Holloway House",'Cedar_Rapids=' + Cedar_Rapids.length); Cedar_Rapids[Cedar_Rapids.length] = createMarker(new GPoint(-91.66521100,41.95766300),"
Holy Family School St Ludmila Center
215 21st Avenue Sw
Cedar Rapids, IA 52404
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Holy Family School St Ludmila Center",'Cedar_Rapids=' + Cedar_Rapids.length); Cedar_Rapids[Cedar_Rapids.length] = createMarker(new GPoint(-91.67210900,42.00562200),"
Isaac Newton Christian Academy
1635 Linmar Dr Ne
Cedar Rapids, IA 52402
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Isaac Newton Christian Academy",'Cedar_Rapids=' + Cedar_Rapids.length); Cedar_Rapids[Cedar_Rapids.length] = createMarker(new GPoint(-91.70661000,42.06393100),"
Jn Andrews Christian Academy
2773 Loggerhead Road
Cedar Rapids, IA 52411
Co-ed school, 3-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Jn Andrews Christian Academy",'Cedar_Rapids=' + Cedar_Rapids.length); Cedar_Rapids[Cedar_Rapids.length] = createMarker(new GPoint(-91.72011700,41.96759900),"
LaSalle Middle School
3700 1st Ave Nw
Cedar Rapids, IA 52405
Co-ed school, 5-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("LaSalle Middle School",'Cedar_Rapids=' + Cedar_Rapids.length); Cedar_Rapids[Cedar_Rapids.length] = createMarker(new GPoint(-91.64702700,42.00245000),"
Regis Middle School
735 Prairie Drive Ne
Cedar Rapids, IA 52402
Co-ed school, 6-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Regis Middle School",'Cedar_Rapids=' + Cedar_Rapids.length); Marion[Marion.length] = createMarker(new GPoint(-91.59487700,42.03955500),"
St. Joseph School
1430 14th Street
Marion, IA 52302
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Joseph School",'Marion=' + Marion.length); Cedar_Rapids[Cedar_Rapids.length] = createMarker(new GPoint(-91.72013800,41.96763700),"
St. Jude Elementary School
3700 1st Avenue Nw
Cedar Rapids, IA 52405
Co-ed school, PK-3
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Jude Elementary School",'Cedar_Rapids=' + Cedar_Rapids.length); Cedar_Rapids[Cedar_Rapids.length] = createMarker(new GPoint(-91.63648500,42.00030700),"
St. Matthew School
125 24th Street Ne
Cedar Rapids, IA 52402
Co-ed school, PK-5
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Matthew School",'Cedar_Rapids=' + Cedar_Rapids.length); Cedar_Rapids[Cedar_Rapids.length] = createMarker(new GPoint(-91.67891400,41.97561100),"
St. Patrick Middle School
509 A Avenue Nw
Cedar Rapids, IA 52405
Co-ed school, 6-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Patrick Middle School",'Cedar_Rapids=' + Cedar_Rapids.length); Cedar_Rapids[Cedar_Rapids.length] = createMarker(new GPoint(-91.67908400,41.97585500),"
St. Patricks Child Care Center
516 A Ave N.w.
Cedar Rapids, IA 52405
Co-ed school, UG-PK
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Patricks Child Care Center",'Cedar_Rapids=' + Cedar_Rapids.length); Cedar_Rapids[Cedar_Rapids.length] = createMarker(new GPoint(-91.65848400,42.02763800),"
St. Pius X Elementary School
4901 Council Street Ne
Cedar Rapids, IA 52402
Co-ed school, PK-5
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Pius X Elementary School",'Cedar_Rapids=' + Cedar_Rapids.length); Cedar_Rapids[Cedar_Rapids.length] = createMarker(new GPoint(-91.64838000,42.02422200),"
Summit Schools Inc
1010 Regent Street NE
Cedar Rapids, IA 52402
Co-ed school, NS-5
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Summit Schools Inc",'Cedar_Rapids=' + Cedar_Rapids.length); Cedar_Rapids[Cedar_Rapids.length] = createMarker(new GPoint(-91.69013700,41.96976300),"
Trinity Lutheran School
1361 7th Avenue Sw
Cedar Rapids, IA 52404
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Trinity Lutheran School",'Cedar_Rapids=' + Cedar_Rapids.length); Cedar_Rapids[Cedar_Rapids.length] = createMarker(new GPoint(-91.72330900,42.02289200),"
Xavier High School
6300 42nd Street Ne
Cedar Rapids, IA 52411
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Xavier High School",'Cedar_Rapids=' + Cedar_Rapids.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/////3/' + showArray); map.removeOverlays(Cedar_Rapids); map.removeOverlays(Hiawatha); map.removeOverlays(Marion); map.removeOverlays(Walker); 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(Cedar_Rapids);map.removeOverlays(Cedar_Rapids); map.removeOverlays(Hiawatha); map.removeOverlays(Marion); map.removeOverlays(Walker); map.addOverlays(Cedar_Rapids); centerByArray(Cedar_Rapids, false, false); cntMarker += Cedar_Rapids.length; map.addOverlays(Hiawatha); centerByArray(Hiawatha, false, false); cntMarker += Hiawatha.length; map.addOverlays(Marion); centerByArray(Marion, false, false); cntMarker += Marion.length; map.addOverlays(Walker); centerByArray(Walker, false, false); cntMarker += Walker.length; centerByArray(Cedar_Rapids,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=3&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; }