function addMarkers(){ mySelect = document.getElementById('selection'); Bremen = [];Nappanee = [];Bourbon = [];Tippecanoe = [];Plymouth = [];mySelect.options[mySelect.options.length] = new Option("Bourbon schools",'all=Bourbon'); mySelect.options[mySelect.options.length] = new Option("Bremen schools",'all=Bremen'); mySelect.options[mySelect.options.length] = new Option("Nappanee schools",'all=Nappanee'); mySelect.options[mySelect.options.length] = new Option("Plymouth schools",'all=Plymouth'); mySelect.options[mySelect.options.length] = new Option("Tippecanoe schools",'all=Tippecanoe'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Bremen[Bremen.length] = createMarker(new GPoint(-86.16840000,41.45870000),"
Borkholder Parochial School
Route 1 Box 264
Bremen, IN 46506
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Borkholder Parochial School",'Bremen=' + Bremen.length); Nappanee[Nappanee.length] = createMarker(new GPoint(-86.07840500,41.45573700),"
Borkholder Parochial School
1660 Beech Road
Nappanee, IN 46550
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Borkholder Parochial School",'Nappanee=' + Nappanee.length); Bourbon[Bourbon.length] = createMarker(new GPoint(-86.11658200,41.30830100),"
Bourbon Christian School
1325 N Main Street
Bourbon, IN 46504
Co-ed school, 1-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bourbon Christian School",'Bourbon=' + Bourbon.length); Bourbon[Bourbon.length] = createMarker(new GPoint(-86.08254200,41.38527400),"
Creekside School
6378 Beech Road
Bourbon, IN 46504
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Creekside School",'Bourbon=' + Bourbon.length); Nappanee[Nappanee.length] = createMarker(new GPoint(-86.07372900,41.46465000),"
New Burlington Amish School
3035 Beech Road R R 1
Nappanee, IN 46550
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("New Burlington Amish School",'Nappanee=' + Nappanee.length); Bremen[Bremen.length] = createMarker(new GPoint(-86.16840000,41.45870000),"
New Burlington Amish School
R R 1 3035 N Beech Rd
Bremen, IN 46506
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("New Burlington Amish School",'Bremen=' + Bremen.length); Tippecanoe[Tippecanoe.length] = createMarker(new GPoint(-86.11492900,41.21613000),"
Pleasant View School
4770 E 18th Road
Tippecanoe, IN 46570
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Pleasant View School",'Tippecanoe=' + Tippecanoe.length); Nappanee[Nappanee.length] = createMarker(new GPoint(-85.99880000,41.44670000),"
Sandy Ridge School
Rr 3 516 1st Rd
Nappanee, IN 46550
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Sandy Ridge School",'Nappanee=' + Nappanee.length); Nappanee[Nappanee.length] = createMarker(new GPoint(-86.08306000,41.41757700),"
South Beech School
4107 Beech Rd
Nappanee, IN 46550
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("South Beech School",'Nappanee=' + Nappanee.length); Bremen[Bremen.length] = createMarker(new GPoint(-86.06562300,41.41896700),"
South Beech School
299 4th Road
Bremen, IN 46506
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("South Beech School",'Bremen=' + Bremen.length); Plymouth[Plymouth.length] = createMarker(new GPoint(-86.31074300,41.34461700),"
St Michael School
612 N Center Street
Plymouth, IN 46563
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Michael School",'Plymouth=' + Plymouth.length); Bremen[Bremen.length] = createMarker(new GPoint(-86.14658200,41.44124400),"
St Paul's Lutheran School
605 S Center Street
Bremen, IN 46506
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Paul's Lutheran School",'Bremen=' + Bremen.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(Bourbon); map.removeOverlays(Bremen); map.removeOverlays(Nappanee); map.removeOverlays(Plymouth); map.removeOverlays(Tippecanoe); 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(Bremen);map.removeOverlays(Bourbon); map.removeOverlays(Bremen); map.removeOverlays(Nappanee); map.removeOverlays(Plymouth); map.removeOverlays(Tippecanoe); map.addOverlays(Bourbon); centerByArray(Bourbon, false, false); cntMarker += Bourbon.length; map.addOverlays(Bremen); centerByArray(Bremen, false, false); cntMarker += Bremen.length; map.addOverlays(Nappanee); centerByArray(Nappanee, false, false); cntMarker += Nappanee.length; map.addOverlays(Plymouth); centerByArray(Plymouth, false, false); cntMarker += Plymouth.length; map.addOverlays(Tippecanoe); centerByArray(Tippecanoe, false, false); cntMarker += Tippecanoe.length; centerByArray(Bremen,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; }