function addMarkers(){ mySelect = document.getElementById('selection'); Wisconsin_Rapids = [];Arpin = [];Marshfield = [];Nekoosa = [];Auburndale = [];Rudolph = [];mySelect.options[mySelect.options.length] = new Option("Arpin schools",'all=Arpin'); mySelect.options[mySelect.options.length] = new Option("Auburndale schools",'all=Auburndale'); mySelect.options[mySelect.options.length] = new Option("Marshfield schools",'all=Marshfield'); mySelect.options[mySelect.options.length] = new Option("Nekoosa schools",'all=Nekoosa'); mySelect.options[mySelect.options.length] = new Option("Rudolph schools",'all=Rudolph'); mySelect.options[mySelect.options.length] = new Option("Wisconsin Rapids schools",'all=Wisconsin_Rapids'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Wisconsin_Rapids[Wisconsin_Rapids.length] = createMarker(new GPoint(-89.82480400,44.38413700),"
Assumption High School
445 Chestnut Street
Wisconsin Rapids, WI 54494
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Assumption High School",'Wisconsin_Rapids=' + Wisconsin_Rapids.length); Wisconsin_Rapids[Wisconsin_Rapids.length] = createMarker(new GPoint(-89.82544400,44.38469200),"
Assumption Middle School
440 Mead Street
Wisconsin Rapids, WI 54494
Co-ed school, 7-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Assumption Middle School",'Wisconsin_Rapids=' + Wisconsin_Rapids.length); Arpin[Arpin.length] = createMarker(new GPoint(-90.08970600,44.53866700),"
Bethel Junior Academy
8054 Bethel Road
Arpin, WI 54410
Co-ed school, 1-7
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bethel Junior Academy",'Arpin=' + Arpin.length); Marshfield[Marshfield.length] = createMarker(new GPoint(-90.19289200,44.66388700),"
Columbus Catholic High School
710 S Columbus Avenue
Marshfield, WI 54449
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Columbus Catholic High School",'Marshfield=' + Marshfield.length); Wisconsin_Rapids[Wisconsin_Rapids.length] = createMarker(new GPoint(-89.77804300,44.42858800),"
Community Christian Academy
550 Center Street
Wisconsin Rapids, WI 54494
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Community Christian Academy",'Wisconsin_Rapids=' + Wisconsin_Rapids.length); Wisconsin_Rapids[Wisconsin_Rapids.length] = createMarker(new GPoint(-89.81020400,44.28267000),"
Good Shepherd Lutheran
10611 State Highway 13 S
Wisconsin Rapids, WI 54494
Co-ed school, 2-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Good Shepherd Lutheran",'Wisconsin_Rapids=' + Wisconsin_Rapids.length); Wisconsin_Rapids[Wisconsin_Rapids.length] = createMarker(new GPoint(-89.81350500,44.38934000),"
Immanuel Lutheran School
111 11th Street N
Wisconsin Rapids, WI 54494
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Immanuel Lutheran School",'Wisconsin_Rapids=' + Wisconsin_Rapids.length); Marshfield[Marshfield.length] = createMarker(new GPoint(-90.17858300,44.66272000),"
Immanuel Lutheran School
604 S Chestnut Avenue
Marshfield, WI 54449
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Immanuel Lutheran School",'Marshfield=' + Marshfield.length); Marshfield[Marshfield.length] = createMarker(new GPoint(-90.19289100,44.66643700),"
Our Lady Of Peace Intermediate School
1300 W 5th Street
Marshfield, WI 54449
Co-ed school, 3-5
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Our Lady Of Peace Intermediate School",'Marshfield=' + Marshfield.length); Wisconsin_Rapids[Wisconsin_Rapids.length] = createMarker(new GPoint(-89.83618700,44.38872900),"
Our Lady Queen Of Heaven Elementary School
750 10th Avenue South
Wisconsin Rapids, WI 54495
Co-ed school, 1-3
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Our Lady Queen Of Heaven Elementary School",'Wisconsin_Rapids=' + Wisconsin_Rapids.length); Nekoosa[Nekoosa.length] = createMarker(new GPoint(-89.88950700,44.32119000),"
Sacred Heart School
710 Vilas Avenue
Nekoosa, WI 54457
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Sacred Heart School",'Nekoosa=' + Nekoosa.length); Marshfield[Marshfield.length] = createMarker(new GPoint(-90.17466000,44.67082900),"
St John Elementary School
307 N Walnut Avenue
Marshfield, WI 54449
Co-ed school, PK-2
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St John Elementary School",'Marshfield=' + Marshfield.length); Wisconsin_Rapids[Wisconsin_Rapids.length] = createMarker(new GPoint(-89.83549200,44.39962600),"
St Lawrence Early Childhood Center
551 10th Avenue N
Wisconsin Rapids, WI 54495
Co-ed school, NS-PK
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Lawrence Early Childhood Center",'Wisconsin_Rapids=' + Wisconsin_Rapids.length); Auburndale[Auburndale.length] = createMarker(new GPoint(-90.00460000,44.65060000),"
St Mary School
Po Box 177 5866 Main Street
Auburndale, WI 54412
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Mary School",'Auburndale=' + Auburndale.length); Wisconsin_Rapids[Wisconsin_Rapids.length] = createMarker(new GPoint(-89.87490000,44.39900000),"
St Pauls Evang Lutheran School
311 14th Avenue South
Wisconsin Rapids, WI 54495
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Pauls Evang Lutheran School",'Wisconsin_Rapids=' + Wisconsin_Rapids.length); Rudolph[Rudolph.length] = createMarker(new GPoint(-89.79640000,44.47830000),"
St Philip School
6975 Grotto Avenue
Rudolph, WI 54475
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Philip School",'Rudolph=' + Rudolph.length); Wisconsin_Rapids[Wisconsin_Rapids.length] = createMarker(new GPoint(-89.81190700,44.38359300),"
St Vincent De Paul School/celebrations Children'
831 12th Street S
Wisconsin Rapids, WI 54494
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Vincent De Paul School/celebrations Children'",'Wisconsin_Rapids=' + Wisconsin_Rapids.length); Marshfield[Marshfield.length] = createMarker(new GPoint(-90.18087300,44.59222200),"
Trinity Lutheran School
9529 State Highway 13
Marshfield, WI 54449
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Trinity Lutheran School",'Marshfield=' + Marshfield.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(Arpin); map.removeOverlays(Auburndale); map.removeOverlays(Marshfield); map.removeOverlays(Nekoosa); map.removeOverlays(Rudolph); map.removeOverlays(Wisconsin_Rapids); 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(Wisconsin_Rapids);map.removeOverlays(Arpin); map.removeOverlays(Auburndale); map.removeOverlays(Marshfield); map.removeOverlays(Nekoosa); map.removeOverlays(Rudolph); map.removeOverlays(Wisconsin_Rapids); map.addOverlays(Arpin); centerByArray(Arpin, false, false); cntMarker += Arpin.length; map.addOverlays(Auburndale); centerByArray(Auburndale, false, false); cntMarker += Auburndale.length; map.addOverlays(Marshfield); centerByArray(Marshfield, false, false); cntMarker += Marshfield.length; map.addOverlays(Nekoosa); centerByArray(Nekoosa, false, false); cntMarker += Nekoosa.length; map.addOverlays(Rudolph); centerByArray(Rudolph, false, false); cntMarker += Rudolph.length; map.addOverlays(Wisconsin_Rapids); centerByArray(Wisconsin_Rapids, false, false); cntMarker += Wisconsin_Rapids.length; centerByArray(Wisconsin_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; }