function addMarkers(){ mySelect = document.getElementById('selection'); Abbotsford = [];Thorp = [];Greenwood = [];Granton = [];Withee = [];Curtiss = [];Colby = [];Loyal = [];Neillsville = [];mySelect.options[mySelect.options.length] = new Option("Abbotsford schools",'all=Abbotsford'); mySelect.options[mySelect.options.length] = new Option("Colby schools",'all=Colby'); mySelect.options[mySelect.options.length] = new Option("Curtiss schools",'all=Curtiss'); mySelect.options[mySelect.options.length] = new Option("Granton schools",'all=Granton'); mySelect.options[mySelect.options.length] = new Option("Greenwood schools",'all=Greenwood'); mySelect.options[mySelect.options.length] = new Option("Loyal schools",'all=Loyal'); mySelect.options[mySelect.options.length] = new Option("Neillsville schools",'all=Neillsville'); mySelect.options[mySelect.options.length] = new Option("Thorp schools",'all=Thorp'); mySelect.options[mySelect.options.length] = new Option("Withee schools",'all=Withee'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Abbotsford[Abbotsford.length] = createMarker(new GPoint(-90.28458200,44.94603600),"
Abbotsford Christian Academy
4868 Cemetary Avenue
Abbotsford, WI 54405
Co-ed school, 1-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Abbotsford Christian Academy",'Abbotsford=' + Abbotsford.length); Thorp[Thorp.length] = createMarker(new GPoint(-90.79601900,44.95199100),"
Abundant Life Christian Academy
107 E Hill Street
Thorp, WI 54771
Co-ed school, 4-4
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Abundant Life Christian Academy",'Thorp=' + Thorp.length); Greenwood[Greenwood.length] = createMarker(new GPoint(-90.62700000,44.77080000),"
Amish School
None-see Note Below
Greenwood, WI 54437
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Amish School",'Greenwood=' + Greenwood.length); Granton[Granton.length] = createMarker(new GPoint(-90.44370000,44.56720000),"
Beaver Creek School
W1722 Hill Road
Granton, WI 54436
Co-ed school, 1-7
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Beaver Creek School",'Granton=' + Granton.length); Withee[Withee.length] = createMarker(new GPoint(-90.67889000,44.91652700),"
Black River Parochial School
N13680 Resewood Avenue
Withee, WI 54498
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Black River Parochial School",'Withee=' + Withee.length); Greenwood[Greenwood.length] = createMarker(new GPoint(-90.62700000,44.77080000),"
Breezeway School

Greenwood, WI 54437
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Breezeway School",'Greenwood=' + Greenwood.length); Thorp[Thorp.length] = createMarker(new GPoint(-90.78049900,44.93878300),"
Bruce Mound Mennonite School
N12770 Gorman Avenue
Thorp, WI 54771
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bruce Mound Mennonite School",'Thorp=' + Thorp.length); Curtiss[Curtiss.length] = createMarker(new GPoint(-90.47487900,45.10335000),"
Green Meadow School
N1192 Oak Drive
Curtiss, WI 54422
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Green Meadow School",'Curtiss=' + Curtiss.length); Thorp[Thorp.length] = createMarker(new GPoint(-90.66969300,45.00242500),"
Pleasant Valley Mennonite School
W7877 Pine Road
Thorp, WI 54771
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Pleasant Valley Mennonite School",'Thorp=' + Thorp.length); Greenwood[Greenwood.length] = createMarker(new GPoint(-90.62700000,44.77080000),"
Pleasant View School

Greenwood, WI 54437
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Pleasant View School",'Greenwood=' + Greenwood.length); Colby[Colby.length] = createMarker(new GPoint(-90.30370000,44.90890000),"
St. Mary School
P. O. Box 408
Colby, WI 54421
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Mary School",'Colby=' + Colby.length); Loyal[Loyal.length] = createMarker(new GPoint(-90.48300000,44.74830000),"
St Anthony School
Po Box 189 208 W Spring Street
Loyal, WI 54446
Co-ed school, K-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Anthony School",'Loyal=' + Loyal.length); Neillsville[Neillsville.length] = createMarker(new GPoint(-90.60654600,44.56011300),"
St John's Lutheran School
805 W 5th Street
Neillsville, WI 54456
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St John's Lutheran School",'Neillsville=' + Neillsville.length); Greenwood[Greenwood.length] = createMarker(new GPoint(-90.62700000,44.77080000),"
St Mary School
Po Box 129 121 N Main St
Greenwood, WI 54437
Co-ed school, 1-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Mary School",'Greenwood=' + Greenwood.length); Colby[Colby.length] = createMarker(new GPoint(-90.32057400,44.90183000),"
St Mary's Grade School
Po Box 408
Colby, WI 54421
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Mary's Grade School",'Colby=' + Colby.length); Thorp[Thorp.length] = createMarker(new GPoint(-90.79519300,44.96033700),"
Thorp Catholic School
411 E School Street
Thorp, WI 54771
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Thorp Catholic School",'Thorp=' + Thorp.length); Thorp[Thorp.length] = createMarker(new GPoint(-90.86149900,44.91736800),"
Thorp Mennonite School
N13749 Koser Avenue
Thorp, WI 54771
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Thorp Mennonite School",'Thorp=' + Thorp.length); Thorp[Thorp.length] = createMarker(new GPoint(-90.79430700,44.95906300),"
Victory Baptist Christian Academy
430 E Stanley Street
Thorp, WI 54771
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Victory Baptist Christian Academy",'Thorp=' + Thorp.length); Neillsville[Neillsville.length] = createMarker(new GPoint(-90.61892300,44.55598000),"
Visions Ii
16 Boon Blvd
Neillsville, WI 54456
All-boys school, 4-11
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Visions Ii",'Neillsville=' + Neillsville.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(Abbotsford); map.removeOverlays(Colby); map.removeOverlays(Curtiss); map.removeOverlays(Granton); map.removeOverlays(Greenwood); map.removeOverlays(Loyal); map.removeOverlays(Neillsville); map.removeOverlays(Thorp); map.removeOverlays(Withee); 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(Abbotsford);map.removeOverlays(Abbotsford); map.removeOverlays(Colby); map.removeOverlays(Curtiss); map.removeOverlays(Granton); map.removeOverlays(Greenwood); map.removeOverlays(Loyal); map.removeOverlays(Neillsville); map.removeOverlays(Thorp); map.removeOverlays(Withee); map.addOverlays(Abbotsford); centerByArray(Abbotsford, false, false); cntMarker += Abbotsford.length; map.addOverlays(Colby); centerByArray(Colby, false, false); cntMarker += Colby.length; map.addOverlays(Curtiss); centerByArray(Curtiss, false, false); cntMarker += Curtiss.length; map.addOverlays(Granton); centerByArray(Granton, false, false); cntMarker += Granton.length; map.addOverlays(Greenwood); centerByArray(Greenwood, false, false); cntMarker += Greenwood.length; map.addOverlays(Loyal); centerByArray(Loyal, false, false); cntMarker += Loyal.length; map.addOverlays(Neillsville); centerByArray(Neillsville, false, false); cntMarker += Neillsville.length; map.addOverlays(Thorp); centerByArray(Thorp, false, false); cntMarker += Thorp.length; map.addOverlays(Withee); centerByArray(Withee, false, false); cntMarker += Withee.length; centerByArray(Abbotsford,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; }