function addMarkers(){ mySelect = document.getElementById('selection'); Hustisford = [];Waupun = [];Lomira = [];Randolph = [];Mayville = [];Watertown = [];Horicon = [];Beaver_Dam = [];Iron_Ridge = [];Fox_Lake = [];Juneau = [];Brownsville = [];mySelect.options[mySelect.options.length] = new Option("Beaver Dam schools",'all=Beaver_Dam'); mySelect.options[mySelect.options.length] = new Option("Brownsville schools",'all=Brownsville'); mySelect.options[mySelect.options.length] = new Option("Fox Lake schools",'all=Fox_Lake'); mySelect.options[mySelect.options.length] = new Option("Horicon schools",'all=Horicon'); mySelect.options[mySelect.options.length] = new Option("Hustisford schools",'all=Hustisford'); mySelect.options[mySelect.options.length] = new Option("Iron Ridge schools",'all=Iron_Ridge'); mySelect.options[mySelect.options.length] = new Option("Juneau schools",'all=Juneau'); mySelect.options[mySelect.options.length] = new Option("Lomira schools",'all=Lomira'); mySelect.options[mySelect.options.length] = new Option("Mayville schools",'all=Mayville'); mySelect.options[mySelect.options.length] = new Option("Randolph schools",'all=Randolph'); mySelect.options[mySelect.options.length] = new Option("Watertown schools",'all=Watertown'); mySelect.options[mySelect.options.length] = new Option("Waupun schools",'all=Waupun'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Hustisford[Hustisford.length] = createMarker(new GPoint(-88.60230000,43.34460000),"
Bethany Lutheran School
Po Box 387 280 N Ridge Street
Hustisford, WI 53034
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bethany Lutheran School",'Hustisford=' + Hustisford.length); Waupun[Waupun.length] = createMarker(new GPoint(-88.75143700,43.62923000),"
Central Wisconsin Christian Schools
301 Fox Lake Road
Waupun, WI 53963
Co-ed school, 6-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Central Wisconsin Christian Schools",'Waupun=' + Waupun.length); Lomira[Lomira.length] = createMarker(new GPoint(-88.45034000,43.59046000),"
Consolidated Catholic School
705 Milwaukee Street
Lomira, WI 53048
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Consolidated Catholic School",'Lomira=' + Lomira.length); Randolph[Randolph.length] = createMarker(new GPoint(-89.00321400,43.54556300),"
Faith Christian School
240 E Cambria Street
Randolph, WI 53956
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Faith Christian School",'Randolph=' + Randolph.length); Mayville[Mayville.length] = createMarker(new GPoint(-88.49787600,43.48508100),"
Immanuel Lutheran School
N8076 Highway Ay
Mayville, WI 53050
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Immanuel Lutheran School",'Mayville=' + Mayville.length); Watertown[Watertown.length] = createMarker(new GPoint(-88.63053800,43.21276100),"
Lebanon Lutheran School
N534 County Road R
Watertown, WI 53098
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Lebanon Lutheran School",'Watertown=' + Watertown.length); Horicon[Horicon.length] = createMarker(new GPoint(-88.59167400,43.44368900),"
Mountain Top Christian Academy
W3941 Highway 33
Horicon, WI 53032
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mountain Top Christian Academy",'Horicon=' + Horicon.length); Beaver_Dam[Beaver_Dam.length] = createMarker(new GPoint(-88.83661000,43.45194000),"
St. Katharine Drexel School
503 S Spring Street
Beaver Dam, WI 53916
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Katharine Drexel School",'Beaver_Dam=' + Beaver_Dam.length); Mayville[Mayville.length] = createMarker(new GPoint(-88.54013400,43.49393700),"
St. Mary Elementary School
28 Naber Street
Mayville, WI 53050
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Mary Elementary School",'Mayville=' + Mayville.length); Iron_Ridge[Iron_Ridge.length] = createMarker(new GPoint(-88.52849200,43.39656300),"
St. Matthews Lutheran School
308 Herman Street
Iron Ridge, WI 53035
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Matthews Lutheran School",'Iron_Ridge=' + Iron_Ridge.length); Mayville[Mayville.length] = createMarker(new GPoint(-88.54410000,43.50050000),"
St. Peter S Lutheran School
Rr 2 23 Main St
Mayville, WI 53050
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Peter S Lutheran School",'Mayville=' + Mayville.length); Horicon[Horicon.length] = createMarker(new GPoint(-88.62438400,43.45497100),"
St. Stephen Lutheran School
505 North Palmatory Street
Horicon, WI 53032
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Stephen Lutheran School",'Horicon=' + Horicon.length); Fox_Lake[Fox_Lake.length] = createMarker(new GPoint(-88.90390000,43.56618700),"
St John's Lutheran School
110 Edgelawn Drive
Fox Lake, WI 53933
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St John's Lutheran School",'Fox_Lake=' + Fox_Lake.length); Lomira[Lomira.length] = createMarker(new GPoint(-88.44001000,43.58848400),"
St Johns Evang Lutheran School
558 S Water Street
Lomira, WI 53048
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Johns Evang Lutheran School",'Lomira=' + Lomira.length); Mayville[Mayville.length] = createMarker(new GPoint(-88.55010800,43.49573700),"
St Johns Lutheran School
520 Bridge Street
Mayville, WI 53050
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Johns Lutheran School",'Mayville=' + Mayville.length); Juneau[Juneau.length] = createMarker(new GPoint(-88.70589700,43.40156900),"
St Johns Lutheran School
402 S Main Street
Juneau, WI 53039
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Johns Lutheran School",'Juneau=' + Juneau.length); Brownsville[Brownsville.length] = createMarker(new GPoint(-88.46057900,43.61636000),"
St Paul Lutheran School
Po Box 370
Brownsville, WI 53006
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Paul Lutheran School",'Brownsville=' + Brownsville.length); Brownsville[Brownsville.length] = createMarker(new GPoint(-88.49085700,43.61506300),"
St Pauls Lutheran School
605 Highland Avenue
Brownsville, WI 53006
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Pauls Lutheran School",'Brownsville=' + Brownsville.length); Beaver_Dam[Beaver_Dam.length] = createMarker(new GPoint(-88.84498900,43.45713700),"
St Stephens Lutheran School
412 West Maple Avenue
Beaver Dam, WI 53916
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Stephens Lutheran School",'Beaver_Dam=' + Beaver_Dam.length); Iron_Ridge[Iron_Ridge.length] = createMarker(new GPoint(-88.54340000,43.39080000),"
Zum Kripplein Christi Lutheran
W1880 Rock Road
Iron Ridge, WI 53035
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Zum Kripplein Christi Lutheran",'Iron_Ridge=' + Iron_Ridge.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(Beaver_Dam); map.removeOverlays(Brownsville); map.removeOverlays(Fox_Lake); map.removeOverlays(Horicon); map.removeOverlays(Hustisford); map.removeOverlays(Iron_Ridge); map.removeOverlays(Juneau); map.removeOverlays(Lomira); map.removeOverlays(Mayville); map.removeOverlays(Randolph); map.removeOverlays(Watertown); map.removeOverlays(Waupun); 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(Hustisford);map.removeOverlays(Beaver_Dam); map.removeOverlays(Brownsville); map.removeOverlays(Fox_Lake); map.removeOverlays(Horicon); map.removeOverlays(Hustisford); map.removeOverlays(Iron_Ridge); map.removeOverlays(Juneau); map.removeOverlays(Lomira); map.removeOverlays(Mayville); map.removeOverlays(Randolph); map.removeOverlays(Watertown); map.removeOverlays(Waupun); map.addOverlays(Beaver_Dam); centerByArray(Beaver_Dam, false, false); cntMarker += Beaver_Dam.length; map.addOverlays(Brownsville); centerByArray(Brownsville, false, false); cntMarker += Brownsville.length; map.addOverlays(Fox_Lake); centerByArray(Fox_Lake, false, false); cntMarker += Fox_Lake.length; map.addOverlays(Horicon); centerByArray(Horicon, false, false); cntMarker += Horicon.length; map.addOverlays(Hustisford); centerByArray(Hustisford, false, false); cntMarker += Hustisford.length; map.addOverlays(Iron_Ridge); centerByArray(Iron_Ridge, false, false); cntMarker += Iron_Ridge.length; map.addOverlays(Juneau); centerByArray(Juneau, false, false); cntMarker += Juneau.length; map.addOverlays(Lomira); centerByArray(Lomira, false, false); cntMarker += Lomira.length; map.addOverlays(Mayville); centerByArray(Mayville, false, false); cntMarker += Mayville.length; map.addOverlays(Randolph); centerByArray(Randolph, false, false); cntMarker += Randolph.length; map.addOverlays(Watertown); centerByArray(Watertown, false, false); cntMarker += Watertown.length; map.addOverlays(Waupun); centerByArray(Waupun, false, false); cntMarker += Waupun.length; centerByArray(Hustisford,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; }