function addMarkers(){ mySelect = document.getElementById('selection'); Berne = [];Decatur = [];Monroe = [];Geneva = [];mySelect.options[mySelect.options.length] = new Option("Berne schools",'all=Berne'); mySelect.options[mySelect.options.length] = new Option("Decatur schools",'all=Decatur'); mySelect.options[mySelect.options.length] = new Option("Geneva schools",'all=Geneva'); mySelect.options[mySelect.options.length] = new Option("Monroe schools",'all=Monroe'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Berne[Berne.length] = createMarker(new GPoint(-84.97510000,40.71426000),"
Clearview Amish School
320 S 200 W
Berne, IN 46711
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Clearview Amish School",'Berne=' + Berne.length); Decatur[Decatur.length] = createMarker(new GPoint(-84.93530000,40.83680000),"
Countryside School
1342 S 250 E
Decatur, IN 46733
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Countryside School",'Decatur=' + Decatur.length); Monroe[Monroe.length] = createMarker(new GPoint(-84.97477000,40.73054100),"
Fairview Amish School
460 W 100 S
Monroe, IN 46772
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Fairview Amish School",'Monroe=' + Monroe.length); Berne[Berne.length] = createMarker(new GPoint(-84.95470000,40.64310000),"
Faith Christian Academy
989 W 700 S
Berne, IN 46711
Co-ed school, 1-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Faith Christian Academy",'Berne=' + Berne.length); Geneva[Geneva.length] = createMarker(new GPoint(-84.90690000,40.60364200),"
Hartford Valley School
4734 W 850 S
Geneva, IN 46740
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Hartford Valley School",'Geneva=' + Geneva.length); Geneva[Geneva.length] = createMarker(new GPoint(-84.85912700,40.60763000),"
Jefferson Parochial Amish School
9522 S 400 E
Geneva, IN 46740
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Jefferson Parochial Amish School",'Geneva=' + Geneva.length); Berne[Berne.length] = createMarker(new GPoint(-84.94620000,40.66040000),"
Lincoln Amish School
525e 575 S.
Berne, IN 46711
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Lincoln Amish School",'Berne=' + Berne.length); Berne[Berne.length] = createMarker(new GPoint(-84.91742200,40.66988000),"
Maple Leaf
5212 S 100 E
Berne, IN 46711
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Maple Leaf",'Berne=' + Berne.length); Monroe[Monroe.length] = createMarker(new GPoint(-84.88315300,40.70243600),"
Oak Grove Amish School
2797 E-300 S
Monroe, IN 46772
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Oak Grove Amish School",'Monroe=' + Monroe.length); Berne[Berne.length] = createMarker(new GPoint(-84.94899600,40.70141300),"
Plain View Amish School
750 S 300 W
Berne, IN 46711
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Plain View Amish School",'Berne=' + Berne.length); Monroe[Monroe.length] = createMarker(new GPoint(-84.91762000,40.72840100),"
Pleasant Valley
1200 S 100 E
Monroe, IN 46772
Co-ed school, 1-7
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Pleasant Valley",'Monroe=' + Monroe.length); Berne[Berne.length] = createMarker(new GPoint(-84.86859600,40.65515900),"
Prairie School
6255 S 350 E
Berne, IN 46711
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Prairie School",'Berne=' + Berne.length); Decatur[Decatur.length] = createMarker(new GPoint(-84.92670400,40.83008500),"
St. Joseph Elementary School
127 N Fourth Street
Decatur, IN 46733
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Joseph Elementary School",'Decatur=' + Decatur.length); Decatur[Decatur.length] = createMarker(new GPoint(-84.86476800,40.90606300),"
St. Peter-immanuel Lutheran
3845 E 1100 N
Decatur, IN 46733
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Peter-immanuel Lutheran",'Decatur=' + Decatur.length); Monroe[Monroe.length] = createMarker(new GPoint(-84.84071800,40.70310000),"
Shady Lane School
2995 S 500 E
Monroe, IN 46772
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Shady Lane School",'Monroe=' + Monroe.length); Geneva[Geneva.length] = createMarker(new GPoint(-84.89257600,40.60745800),"
South Adams Parochial
9520 S 225 E
Geneva, IN 46740
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("South Adams Parochial",'Geneva=' + Geneva.length); Berne[Berne.length] = createMarker(new GPoint(-84.93530000,40.83680000),"
South East Amish School
8750 S. 300 E
Berne, IN 46733
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("South East Amish School",'Berne=' + Berne.length); Geneva[Geneva.length] = createMarker(new GPoint(-84.87917600,40.61523700),"
Southeast Amish School
2959 E 900 S
Geneva, IN 46740
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Southeast Amish School",'Geneva=' + Geneva.length); Decatur[Decatur.length] = createMarker(new GPoint(-84.92669800,40.83009900),"
St Joseph School
127 N 4th Street
Decatur, IN 46733
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Joseph School",'Decatur=' + Decatur.length); Berne[Berne.length] = createMarker(new GPoint(-84.93418200,40.64376900),"
Sunnyside Amish School
75 E. 700 S
Berne, IN 46711
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Sunnyside Amish School",'Berne=' + Berne.length); Monroe[Monroe.length] = createMarker(new GPoint(-84.93689100,40.73697700),"
Swiss Valley
100 S 000 Rd
Monroe, IN 46772
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Swiss Valley",'Monroe=' + Monroe.length); Geneva[Geneva.length] = createMarker(new GPoint(-84.95243900,40.62153000),"
Wabash Valley
998 W 850 S
Geneva, IN 46740
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Wabash Valley",'Geneva=' + Geneva.length); Geneva[Geneva.length] = createMarker(new GPoint(-84.99022800,40.62043300),"
West Wabash School
2818 W 850 S
Geneva, IN 46740
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("West Wabash School",'Geneva=' + Geneva.length); Monroe[Monroe.length] = createMarker(new GPoint(-84.92660000,40.72840000),"
Winchester Amish School C/o Girod
1998 W State Rd, 1005
Monroe, IN 46772
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Winchester Amish School C/o Girod",'Monroe=' + Monroe.length); Decatur[Decatur.length] = createMarker(new GPoint(-85.00807100,40.91334500),"
Wyneken Memorial Lutheran School
11565 N Us Highway 27
Decatur, IN 46733
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Wyneken Memorial Lutheran School",'Decatur=' + Decatur.length); Decatur[Decatur.length] = createMarker(new GPoint(-84.93410300,40.82997300),"
Zion Lutheran School
1022 W Monroe Street
Decatur, IN 46733
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Zion Lutheran School",'Decatur=' + Decatur.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(Berne); map.removeOverlays(Decatur); map.removeOverlays(Geneva); map.removeOverlays(Monroe); 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(Berne);map.removeOverlays(Berne); map.removeOverlays(Decatur); map.removeOverlays(Geneva); map.removeOverlays(Monroe); map.addOverlays(Berne); centerByArray(Berne, false, false); cntMarker += Berne.length; map.addOverlays(Decatur); centerByArray(Decatur, false, false); cntMarker += Decatur.length; map.addOverlays(Geneva); centerByArray(Geneva, false, false); cntMarker += Geneva.length; map.addOverlays(Monroe); centerByArray(Monroe, false, false); cntMarker += Monroe.length; centerByArray(Berne,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; }