function addMarkers(){ mySelect = document.getElementById('selection'); Cascade = [];Sherrill = [];Dubuque = [];Dyersville = [];New_Vienna = [];Luxemburg = [];Holy_Cross = [];Epworth = [];Farley = [];Peosta = [];Worthington = [];mySelect.options[mySelect.options.length] = new Option("Cascade schools",'all=Cascade'); mySelect.options[mySelect.options.length] = new Option("Dubuque schools",'all=Dubuque'); mySelect.options[mySelect.options.length] = new Option("Dyersville schools",'all=Dyersville'); mySelect.options[mySelect.options.length] = new Option("Epworth schools",'all=Epworth'); mySelect.options[mySelect.options.length] = new Option("Farley schools",'all=Farley'); mySelect.options[mySelect.options.length] = new Option("Holy Cross schools",'all=Holy_Cross'); mySelect.options[mySelect.options.length] = new Option("Luxemburg schools",'all=Luxemburg'); mySelect.options[mySelect.options.length] = new Option("New Vienna schools",'all=New_Vienna'); mySelect.options[mySelect.options.length] = new Option("Peosta schools",'all=Peosta'); mySelect.options[mySelect.options.length] = new Option("Sherrill schools",'all=Sherrill'); mySelect.options[mySelect.options.length] = new Option("Worthington schools",'all=Worthington'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Cascade[Cascade.length] = createMarker(new GPoint(-91.02046900,42.29913700),"
Aquin Catholic Elementary School
Po Box 460 608 3rd Avenue Nw
Cascade, IA 52033
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Aquin Catholic Elementary School",'Cascade=' + Cascade.length); Sherrill[Sherrill.length] = createMarker(new GPoint(-90.82750000,42.62540000),"
Balltown-sherrill Catholic School
Po Box 49
Sherrill, IA 52073
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Balltown-sherrill Catholic School",'Sherrill=' + Sherrill.length); Dubuque[Dubuque.length] = createMarker(new GPoint(-90.72063500,42.50925700),"
Dubuque Lutheran School
2145 JFK Road
Dubuque, IA 52002
Co-ed school, K-5
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Dubuque Lutheran School",'Dubuque=' + Dubuque.length); Dubuque[Dubuque.length] = createMarker(new GPoint(-90.70312700,42.50036200),"
Dubuque Montessori School
2605 Pennsylvania Avenue
Dubuque, IA 52001
Co-ed school, NS-PK
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Dubuque Montessori School",'Dubuque=' + Dubuque.length); Dubuque[Dubuque.length] = createMarker(new GPoint(-90.73008900,42.52889000),"
Grand View Preschool & Child Development Center
3342 John Wesley Drive
Dubuque, IA 52002
Co-ed school, NS-PK
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Grand View Preschool & Child Development Center",'Dubuque=' + Dubuque.length); Dyersville[Dyersville.length] = createMarker(new GPoint(-91.21341500,42.55601800),"
Hennessey Catholic School Pete
1623 300th Avenue
Dyersville, IA 52040
Co-ed school, 4-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Hennessey Catholic School Pete",'Dyersville=' + Dyersville.length); New_Vienna[New_Vienna.length] = createMarker(new GPoint(-91.10670000,42.56310000),"
Hennessy Catholic School
Po Box 170
New Vienna, IA 52065
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Hennessy Catholic School",'New_Vienna=' + New_Vienna.length); Dubuque[Dubuque.length] = createMarker(new GPoint(-90.68027200,42.52444800),"
Holy Ghost Elementary School
2981 Central Avenue
Dubuque, IA 52001
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Holy Ghost Elementary School",'Dubuque=' + Dubuque.length); Luxemburg[Luxemburg.length] = createMarker(new GPoint(-91.07450000,42.60310000),"
Lasalle Catholic
Po Box 139 100 W Main Street
Luxemburg, IA 52056
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Lasalle Catholic",'Luxemburg=' + Luxemburg.length); Holy_Cross[Holy_Cross.length] = createMarker(new GPoint(-90.99670400,42.60032500),"
Lasalle Catholic School
835 Church Street
Holy Cross, IA 52053
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Lasalle Catholic School",'Holy_Cross=' + Holy_Cross.length); Dubuque[Dubuque.length] = createMarker(new GPoint(-90.67884500,42.49917900),"
Nativity Grade School
1001 Alta Vista St
Dubuque, IA 52001
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Nativity Grade School",'Dubuque=' + Dubuque.length); Dubuque[Dubuque.length] = createMarker(new GPoint(-90.73510600,42.51515600),"
Resurrection School
4300 Asbury Road
Dubuque, IA 52002
Co-ed school, K-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Resurrection School",'Dubuque=' + Dubuque.length); Dubuque[Dubuque.length] = createMarker(new GPoint(-90.69732300,42.50410400),"
St. Anthony School
2175 Rosedale Avenue
Dubuque, IA 52001
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Anthony School",'Dubuque=' + Dubuque.length); Dubuque[Dubuque.length] = createMarker(new GPoint(-90.66678000,42.51635800),"
St. Francis Primary
2222 Queen
Dubuque, IA 52001
Co-ed school, PK-5
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Francis Primary",'Dubuque=' + Dubuque.length); Dubuque[Dubuque.length] = createMarker(new GPoint(-90.69323400,42.49093600),"
St. Joseph The Worker School
2105 Saint Joseph Street
Dubuque, IA 52001
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Joseph The Worker School",'Dubuque=' + Dubuque.length); Dubuque[Dubuque.length] = createMarker(new GPoint(-90.66990300,42.50649100),"
St. Mary-st. Patrick School
180 West 15th St
Dubuque, IA 52001
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Mary-st. Patrick School",'Dubuque=' + Dubuque.length); Epworth[Epworth.length] = createMarker(new GPoint(-90.93230000,42.44770000),"
Seton Catholic Elem. School
Po Box 246
Epworth, IA 52045
Co-ed school, KG-2
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Seton Catholic Elem. School",'Epworth=' + Epworth.length); Epworth[Epworth.length] = createMarker(new GPoint(-90.93337600,42.44684900),"
Seton Catholic Elementary School Epworth Center
Po Box 246 106 1st St Se
Epworth, IA 52045
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Seton Catholic Elementary School Epworth Center",'Epworth=' + Epworth.length); Farley[Farley.length] = createMarker(new GPoint(-91.00462900,42.44166300),"
Seton Catholic School
210 2nd Avenue Se
Farley, IA 52046
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Seton Catholic School",'Farley=' + Farley.length); Peosta[Peosta.length] = createMarker(new GPoint(-90.85058500,42.44059000),"
Seton Catholic-st John
10801 Sundown Road
Peosta, IA 52068
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Seton Catholic-st John",'Peosta=' + Peosta.length); Dubuque[Dubuque.length] = createMarker(new GPoint(-90.67514800,42.48642500),"
St Columbkille School
1198 Rush Street
Dubuque, IA 52003
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Columbkille School",'Dubuque=' + Dubuque.length); Dyersville[Dyersville.length] = createMarker(new GPoint(-91.12561300,42.48344700),"
St Francis Xavier Elementary School
203 2nd Street Sw
Dyersville, IA 52040
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Francis Xavier Elementary School",'Dyersville=' + Dyersville.length); Dubuque[Dubuque.length] = createMarker(new GPoint(-90.68484000,42.44252600),"
St Joseph School-key West
10244 Key West Drive
Dubuque, IA 52003
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Joseph School-key West",'Dubuque=' + Dubuque.length); Worthington[Worthington.length] = createMarker(new GPoint(-91.12087300,42.39512400),"
St Paul School
309 3rd Avenue Sw
Worthington, IA 52078
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Paul School",'Worthington=' + Worthington.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(Cascade); map.removeOverlays(Dubuque); map.removeOverlays(Dyersville); map.removeOverlays(Epworth); map.removeOverlays(Farley); map.removeOverlays(Holy_Cross); map.removeOverlays(Luxemburg); map.removeOverlays(New_Vienna); map.removeOverlays(Peosta); map.removeOverlays(Sherrill); map.removeOverlays(Worthington); 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(Cascade);map.removeOverlays(Cascade); map.removeOverlays(Dubuque); map.removeOverlays(Dyersville); map.removeOverlays(Epworth); map.removeOverlays(Farley); map.removeOverlays(Holy_Cross); map.removeOverlays(Luxemburg); map.removeOverlays(New_Vienna); map.removeOverlays(Peosta); map.removeOverlays(Sherrill); map.removeOverlays(Worthington); map.addOverlays(Cascade); centerByArray(Cascade, false, false); cntMarker += Cascade.length; map.addOverlays(Dubuque); centerByArray(Dubuque, false, false); cntMarker += Dubuque.length; map.addOverlays(Dyersville); centerByArray(Dyersville, false, false); cntMarker += Dyersville.length; map.addOverlays(Epworth); centerByArray(Epworth, false, false); cntMarker += Epworth.length; map.addOverlays(Farley); centerByArray(Farley, false, false); cntMarker += Farley.length; map.addOverlays(Holy_Cross); centerByArray(Holy_Cross, false, false); cntMarker += Holy_Cross.length; map.addOverlays(Luxemburg); centerByArray(Luxemburg, false, false); cntMarker += Luxemburg.length; map.addOverlays(New_Vienna); centerByArray(New_Vienna, false, false); cntMarker += New_Vienna.length; map.addOverlays(Peosta); centerByArray(Peosta, false, false); cntMarker += Peosta.length; map.addOverlays(Sherrill); centerByArray(Sherrill, false, false); cntMarker += Sherrill.length; map.addOverlays(Worthington); centerByArray(Worthington, false, false); cntMarker += Worthington.length; centerByArray(Cascade,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; }