function addMarkers(){ mySelect = document.getElementById('selection'); Bettendorf = [];Cedar_Rapids = [];Clarinda = [];Dubuque = [];Fort_Madison = [];Maquoketa = [];Newell = [];West_Des_Moines = [];mySelect.options[mySelect.options.length] = new Option("Bettendorf schools",'all=Bettendorf'); mySelect.options[mySelect.options.length] = new Option("Cedar Rapids schools",'all=Cedar_Rapids'); mySelect.options[mySelect.options.length] = new Option("Clarinda schools",'all=Clarinda'); mySelect.options[mySelect.options.length] = new Option("Dubuque schools",'all=Dubuque'); mySelect.options[mySelect.options.length] = new Option("Fort Madison schools",'all=Fort_Madison'); mySelect.options[mySelect.options.length] = new Option("Maquoketa schools",'all=Maquoketa'); mySelect.options[mySelect.options.length] = new Option("Newell schools",'all=Newell'); mySelect.options[mySelect.options.length] = new Option("West Des Moines schools",'all=West_Des_Moines'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Bettendorf[Bettendorf.length] = createMarker(new GPoint(-90.49722500,41.55348800),"
Kids Choice
2986 Victoria St
Bettendorf, IA 52722
Co-ed school, KG-KG
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Kids Choice",'Bettendorf=' + Bettendorf.length); Bettendorf[Bettendorf.length] = createMarker(new GPoint(-90.48820000,41.55290000),"
The Bettendorf Kindergar
2330 Tech Dr 2330 Tech Dr
Bettendorf, IA 52722
Co-ed school, PK-KG
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The Bettendorf Kindergar",'Bettendorf=' + Bettendorf.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.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); Clarinda[Clarinda.length] = createMarker(new GPoint(-95.03351800,40.74043700),"
St John Lutheran Preschool & Kindergarten
301 N 13th Street
Clarinda, IA 51632
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St John Lutheran Preschool & Kindergarten",'Clarinda=' + Clarinda.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); Fort_Madison[Fort_Madison.length] = createMarker(new GPoint(-91.33720400,40.62833700),"
Holy Trinity Early Childhood Center
2213 Avenue J
Fort Madison, IA 52627
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Holy Trinity Early Childhood Center",'Fort_Madison=' + Fort_Madison.length); Maquoketa[Maquoketa.length] = createMarker(new GPoint(-90.67837800,42.06913400),"
Child Development, Inc.
101 Creslane Drive
Maquoketa, IA 52060
Co-ed school, K-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Child Development, Inc.",'Maquoketa=' + Maquoketa.length); Newell[Newell.length] = createMarker(new GPoint(-94.99383400,42.61690000),"
Newell Pride & Joy
Po Box 134
Newell, IA 50568
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Newell Pride & Joy",'Newell=' + Newell.length); West_Des_Moines[West_Des_Moines.length] = createMarker(new GPoint(-93.75678100,41.58456300),"
Shepherd's Flock Early Learning Center
3900 Ashworth Road
West Des Moines, IA 50265
Co-ed school, NS-PK
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Shepherd's Flock Early Learning Center",'West_Des_Moines=' + West_Des_Moines.length); West_Des_Moines[West_Des_Moines.length] = createMarker(new GPoint(-93.73683100,41.60696200),"
Early Education Center
1721 25th Street
West Des Moines, IA 50266
Co-ed school, NS-PK
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Early Education Center",'West_Des_Moines=' + West_Des_Moines.length); map.removeOverlays(Bettendorf); map.removeOverlays(Cedar_Rapids); map.removeOverlays(Clarinda); map.removeOverlays(Dubuque); map.removeOverlays(Fort_Madison); map.removeOverlays(Maquoketa); map.removeOverlays(Newell); map.removeOverlays(West_Des_Moines); setTimeout(function(){map.addOverlays(Bettendorf)},1000); setTimeout(function(){map.addOverlays(Cedar_Rapids)},1000); setTimeout(function(){map.addOverlays(Clarinda)},1000); setTimeout(function(){map.addOverlays(Dubuque)},1000); setTimeout(function(){map.addOverlays(Fort_Madison)},1000); setTimeout(function(){map.addOverlays(Maquoketa)},1000); setTimeout(function(){map.addOverlays(Newell)},1000); setTimeout(function(){map.addOverlays(West_Des_Moines)},1000); maxLng = -90.48820000; maxLat = 42.61690000; minLng = -95.03351800; minLat = 40.62833700; 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(Bettendorf); map.removeOverlays(Cedar_Rapids); map.removeOverlays(Clarinda); map.removeOverlays(Dubuque); map.removeOverlays(Fort_Madison); map.removeOverlays(Maquoketa); map.removeOverlays(Newell); map.removeOverlays(West_Des_Moines); 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(Bettendorf);map.removeOverlays(Bettendorf); map.removeOverlays(Cedar_Rapids); map.removeOverlays(Clarinda); map.removeOverlays(Dubuque); map.removeOverlays(Fort_Madison); map.removeOverlays(Maquoketa); map.removeOverlays(Newell); map.removeOverlays(West_Des_Moines); map.addOverlays(Bettendorf); centerByArray(Bettendorf, false, false); cntMarker += Bettendorf.length; map.addOverlays(Cedar_Rapids); centerByArray(Cedar_Rapids, false, false); cntMarker += Cedar_Rapids.length; map.addOverlays(Clarinda); centerByArray(Clarinda, false, false); cntMarker += Clarinda.length; map.addOverlays(Dubuque); centerByArray(Dubuque, false, false); cntMarker += Dubuque.length; map.addOverlays(Fort_Madison); centerByArray(Fort_Madison, false, false); cntMarker += Fort_Madison.length; map.addOverlays(Maquoketa); centerByArray(Maquoketa, false, false); cntMarker += Maquoketa.length; map.addOverlays(Newell); centerByArray(Newell, false, false); cntMarker += Newell.length; map.addOverlays(West_Des_Moines); centerByArray(West_Des_Moines, false, false); cntMarker += West_Des_Moines.length; centerByArray(Bettendorf,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=2&schools=&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; }