function addMarkers(){ mySelect = document.getElementById('selection'); Ames = [];Ankeny = [];Cedar_Rapids = [];Fort_Dodge = [];Urbandale = [];Estherville = [];Fairfield = [];Muscatine = [];Forest_City = [];Des_Moines = [];Eldridge = [];Centerville = [];North_Liberty = [];West_Des_Moines = [];Bettendorf = [];Mount_Pleasant = [];Ottumwa = [];Sioux_City = [];Indianola = [];Waterloo = [];mySelect.options[mySelect.options.length] = new Option("Ames schools",'all=Ames'); mySelect.options[mySelect.options.length] = new Option("Ankeny schools",'all=Ankeny'); 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("Centerville schools",'all=Centerville'); mySelect.options[mySelect.options.length] = new Option("Des Moines schools",'all=Des_Moines'); mySelect.options[mySelect.options.length] = new Option("Eldridge schools",'all=Eldridge'); mySelect.options[mySelect.options.length] = new Option("Estherville schools",'all=Estherville'); mySelect.options[mySelect.options.length] = new Option("Fairfield schools",'all=Fairfield'); mySelect.options[mySelect.options.length] = new Option("Forest City schools",'all=Forest_City'); mySelect.options[mySelect.options.length] = new Option("Fort Dodge schools",'all=Fort_Dodge'); mySelect.options[mySelect.options.length] = new Option("Indianola schools",'all=Indianola'); mySelect.options[mySelect.options.length] = new Option("Mount Pleasant schools",'all=Mount_Pleasant'); mySelect.options[mySelect.options.length] = new Option("Muscatine schools",'all=Muscatine'); mySelect.options[mySelect.options.length] = new Option("North Liberty schools",'all=North_Liberty'); mySelect.options[mySelect.options.length] = new Option("Ottumwa schools",'all=Ottumwa'); mySelect.options[mySelect.options.length] = new Option("Sioux City schools",'all=Sioux_City'); mySelect.options[mySelect.options.length] = new Option("Urbandale schools",'all=Urbandale'); mySelect.options[mySelect.options.length] = new Option("Waterloo schools",'all=Waterloo'); mySelect.options[mySelect.options.length] = new Option("West Des Moines schools",'all=West_Des_Moines'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Ames[Ames.length] = createMarker(new GPoint(-93.62411300,42.00850200),"
Ames Christian School
925 South 16th Street
Ames, IA 50010
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Ames Christian School",'Ames=' + Ames.length); Ankeny[Ankeny.length] = createMarker(new GPoint(-93.62190600,41.73199300),"
Ankeny Christian Academy
1604 West 1st St
Ankeny, IA 50023
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Ankeny Christian Academy",'Ankeny=' + Ankeny.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); Fort_Dodge[Fort_Dodge.length] = createMarker(new GPoint(-94.15252200,42.51583700),"
Community Christian School
3058 10th Avenue N
Fort Dodge, IA 50501
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Community Christian School",'Fort_Dodge=' + Fort_Dodge.length); Urbandale[Urbandale.length] = createMarker(new GPoint(-93.68281200,41.61142700),"
Des Moines Christian School
13007 Douglas Parkway
Urbandale, IA 50323
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Des Moines Christian School",'Urbandale=' + Urbandale.length); Estherville[Estherville.length] = createMarker(new GPoint(-94.87599500,43.41499100),"
Estherville Community Christian School
3647 Highway 9
Estherville, IA 51334
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Estherville Community Christian School",'Estherville=' + Estherville.length); Fairfield[Fairfield.length] = createMarker(new GPoint(-91.96297300,40.98606700),"
Fairfield Christian School
2009 S Main Street
Fairfield, IA 52556
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Fairfield Christian School",'Fairfield=' + Fairfield.length); Muscatine[Muscatine.length] = createMarker(new GPoint(-91.03889600,41.44591300),"
Faith Academy
736 Lake Park Blvd
Muscatine, IA 52761
Co-ed school, KG-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Faith Academy",'Muscatine=' + Muscatine.length); Forest_City[Forest_City.length] = createMarker(new GPoint(-93.63938800,43.27707200),"
Forest City Christian School
305 Walnut Street
Forest City, IA 50436
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Forest City Christian School",'Forest_City=' + Forest_City.length); Des_Moines[Des_Moines.length] = createMarker(new GPoint(-93.55138200,41.60914700),"
Grandview Park Baptist School
1701 E 33rd Street
Des Moines, IA 50317
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Grandview Park Baptist School",'Des_Moines=' + Des_Moines.length); Eldridge[Eldridge.length] = createMarker(new GPoint(-90.54549700,41.69218600),"
Heritage Christian School
507 Parkview Drive
Eldridge, IA 52748
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Heritage Christian School",'Eldridge=' + Eldridge.length); Centerville[Centerville.length] = createMarker(new GPoint(-92.87758000,40.74223800),"
Heritage Christian School
914 N Park
Centerville, IA 52544
Co-ed school, 4-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Heritage Christian School",'Centerville=' + Centerville.length); North_Liberty[North_Liberty.length] = createMarker(new GPoint(-91.57664300,41.73350400),"
Heritage Christian School
2709 Dubuque St. Ne
North Liberty, IA 52317
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Heritage Christian School",'North_Liberty=' + North_Liberty.length); West_Des_Moines[West_Des_Moines.length] = createMarker(new GPoint(-93.73943900,41.57951300),"
Iowa Christian Academy
2501 Vine Street
West Des Moines, IA 50265
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Iowa Christian Academy",'West_Des_Moines=' + West_Des_Moines.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); Bettendorf[Bettendorf.length] = createMarker(new GPoint(-90.51225900,41.56047300),"
Morning Star Academy
1426 Tanglefoot Lane
Bettendorf, IA 52722
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Morning Star Academy",'Bettendorf=' + Bettendorf.length); Mount_Pleasant[Mount_Pleasant.length] = createMarker(new GPoint(-91.53124100,40.96318900),"
Mt Pleasant Christian School
1505 E Washington Street
Mount Pleasant, IA 52641
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mt Pleasant Christian School",'Mount_Pleasant=' + Mount_Pleasant.length); Ottumwa[Ottumwa.length] = createMarker(new GPoint(-92.40867600,41.02442300),"
Ottumwa Christian School
458 North Court
Ottumwa, IA 52501
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Ottumwa Christian School",'Ottumwa=' + Ottumwa.length); Sioux_City[Sioux_City.length] = createMarker(new GPoint(-96.32963600,42.46200800),"
Siouxland Community Christian School
6100 Morningside Avenue
Sioux City, IA 51106
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Siouxland Community Christian School",'Sioux_City=' + Sioux_City.length); Indianola[Indianola.length] = createMarker(new GPoint(-93.57060000,41.35360000),"
Victory Christian Academy
805 N 1st Street
Indianola, IA 50125
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Victory Christian Academy",'Indianola=' + Indianola.length); Waterloo[Waterloo.length] = createMarker(new GPoint(-92.37680300,42.46926300),"
Walnut Ridge Baptist Academy
1307 W Ridgeway Avenue
Waterloo, IA 50701
Co-ed school, 5-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Walnut Ridge Baptist Academy",'Waterloo=' + Waterloo.length); map.removeOverlays(Ames); map.removeOverlays(Ankeny); map.removeOverlays(Bettendorf); map.removeOverlays(Cedar_Rapids); map.removeOverlays(Centerville); map.removeOverlays(Des_Moines); map.removeOverlays(Eldridge); map.removeOverlays(Estherville); map.removeOverlays(Fairfield); map.removeOverlays(Forest_City); map.removeOverlays(Fort_Dodge); map.removeOverlays(Indianola); map.removeOverlays(Mount_Pleasant); map.removeOverlays(Muscatine); map.removeOverlays(North_Liberty); map.removeOverlays(Ottumwa); map.removeOverlays(Sioux_City); map.removeOverlays(Urbandale); map.removeOverlays(Waterloo); map.removeOverlays(West_Des_Moines); setTimeout(function(){map.addOverlays(Ames)},1000); setTimeout(function(){map.addOverlays(Ankeny)},1000); setTimeout(function(){map.addOverlays(Bettendorf)},1000); setTimeout(function(){map.addOverlays(Cedar_Rapids)},1000); setTimeout(function(){map.addOverlays(Centerville)},1000); setTimeout(function(){map.addOverlays(Des_Moines)},1000); setTimeout(function(){map.addOverlays(Eldridge)},1000); setTimeout(function(){map.addOverlays(Estherville)},1000); setTimeout(function(){map.addOverlays(Fairfield)},1000); setTimeout(function(){map.addOverlays(Forest_City)},1000); setTimeout(function(){map.addOverlays(Fort_Dodge)},1000); setTimeout(function(){map.addOverlays(Indianola)},1000); setTimeout(function(){map.addOverlays(Mount_Pleasant)},1000); setTimeout(function(){map.addOverlays(Muscatine)},1000); setTimeout(function(){map.addOverlays(North_Liberty)},1000); setTimeout(function(){map.addOverlays(Ottumwa)},1000); setTimeout(function(){map.addOverlays(Sioux_City)},1000); setTimeout(function(){map.addOverlays(Urbandale)},1000); setTimeout(function(){map.addOverlays(Waterloo)},1000); setTimeout(function(){map.addOverlays(West_Des_Moines)},1000); maxLng = -90.51225900; maxLat = 43.41499100; minLng = -96.32963600; minLat = 40.74223800; 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(Ames); map.removeOverlays(Ankeny); map.removeOverlays(Bettendorf); map.removeOverlays(Cedar_Rapids); map.removeOverlays(Centerville); map.removeOverlays(Des_Moines); map.removeOverlays(Eldridge); map.removeOverlays(Estherville); map.removeOverlays(Fairfield); map.removeOverlays(Forest_City); map.removeOverlays(Fort_Dodge); map.removeOverlays(Indianola); map.removeOverlays(Mount_Pleasant); map.removeOverlays(Muscatine); map.removeOverlays(North_Liberty); map.removeOverlays(Ottumwa); map.removeOverlays(Sioux_City); map.removeOverlays(Urbandale); map.removeOverlays(Waterloo); 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(Ames);map.removeOverlays(Ames); map.removeOverlays(Ankeny); map.removeOverlays(Bettendorf); map.removeOverlays(Cedar_Rapids); map.removeOverlays(Centerville); map.removeOverlays(Des_Moines); map.removeOverlays(Eldridge); map.removeOverlays(Estherville); map.removeOverlays(Fairfield); map.removeOverlays(Forest_City); map.removeOverlays(Fort_Dodge); map.removeOverlays(Indianola); map.removeOverlays(Mount_Pleasant); map.removeOverlays(Muscatine); map.removeOverlays(North_Liberty); map.removeOverlays(Ottumwa); map.removeOverlays(Sioux_City); map.removeOverlays(Urbandale); map.removeOverlays(Waterloo); map.removeOverlays(West_Des_Moines); map.addOverlays(Ames); centerByArray(Ames, false, false); cntMarker += Ames.length; map.addOverlays(Ankeny); centerByArray(Ankeny, false, false); cntMarker += Ankeny.length; 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(Centerville); centerByArray(Centerville, false, false); cntMarker += Centerville.length; map.addOverlays(Des_Moines); centerByArray(Des_Moines, false, false); cntMarker += Des_Moines.length; map.addOverlays(Eldridge); centerByArray(Eldridge, false, false); cntMarker += Eldridge.length; map.addOverlays(Estherville); centerByArray(Estherville, false, false); cntMarker += Estherville.length; map.addOverlays(Fairfield); centerByArray(Fairfield, false, false); cntMarker += Fairfield.length; map.addOverlays(Forest_City); centerByArray(Forest_City, false, false); cntMarker += Forest_City.length; map.addOverlays(Fort_Dodge); centerByArray(Fort_Dodge, false, false); cntMarker += Fort_Dodge.length; map.addOverlays(Indianola); centerByArray(Indianola, false, false); cntMarker += Indianola.length; map.addOverlays(Mount_Pleasant); centerByArray(Mount_Pleasant, false, false); cntMarker += Mount_Pleasant.length; map.addOverlays(Muscatine); centerByArray(Muscatine, false, false); cntMarker += Muscatine.length; map.addOverlays(North_Liberty); centerByArray(North_Liberty, false, false); cntMarker += North_Liberty.length; map.addOverlays(Ottumwa); centerByArray(Ottumwa, false, false); cntMarker += Ottumwa.length; map.addOverlays(Sioux_City); centerByArray(Sioux_City, false, false); cntMarker += Sioux_City.length; map.addOverlays(Urbandale); centerByArray(Urbandale, false, false); cntMarker += Urbandale.length; map.addOverlays(Waterloo); centerByArray(Waterloo, false, false); cntMarker += Waterloo.length; map.addOverlays(West_Des_Moines); centerByArray(West_Des_Moines, false, false); cntMarker += West_Des_Moines.length; centerByArray(Ames,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///10600,10601,8998,10620,10684,10659,10651,10660,10644,10646,10710,10726,10708,10637,10679,10600,10601,8998,10620,10684,10659,10651,10660,10856,10644,10646,10629,10847,10710,10645,10658,10726,10708,10637,10846,10679,/all'); //window.open('/map.php?type=2&schools=10600,10601,8998,10620,10684,10659,10651,10660,10644,10646,10710,10726,10708,10637,10679,10600,10601,8998,10620,10684,10659,10651,10660,10856,10644,10646,10629,10847,10710,10645,10658,10726,10708,10637,10846,10679,&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; }