function addMarkers(){ mySelect = document.getElementById('selection'); Nappanee = [];North_Manchester = [];Warsaw = [];Milford = [];Etna_Green = [];mySelect.options[mySelect.options.length] = new Option("Etna Green schools",'all=Etna_Green'); mySelect.options[mySelect.options.length] = new Option("Milford schools",'all=Milford'); mySelect.options[mySelect.options.length] = new Option("Nappanee schools",'all=Nappanee'); mySelect.options[mySelect.options.length] = new Option("North Manchester schools",'all=North_Manchester'); mySelect.options[mySelect.options.length] = new Option("Warsaw schools",'all=Warsaw'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Nappanee[Nappanee.length] = createMarker(new GPoint(-85.99880000,41.44670000),"
Corner View School
7022 W 1300 N
Nappanee, IN 46550
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Corner View School",'Nappanee=' + Nappanee.length); Nappanee[Nappanee.length] = createMarker(new GPoint(-86.03780200,41.40947200),"
Hepton School
9915 W Hepton Road
Nappanee, IN 46550
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Hepton School",'Nappanee=' + Nappanee.length); North_Manchester[North_Manchester.length] = createMarker(new GPoint(-85.77680000,40.99550000),"
Hopewell
Po Box 266
North Manchester, IN 46962
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Hopewell",'North_Manchester=' + North_Manchester.length); Warsaw[Warsaw.length] = createMarker(new GPoint(-85.85680800,41.22024300),"
Lighthouse Christian Academy
125 Fawley St
Warsaw, IN 46580
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Lighthouse Christian Academy",'Warsaw=' + Warsaw.length); Milford[Milford.length] = createMarker(new GPoint(-85.94230900,41.36184400),"
Maple Grove Amish School
4968 W 900 N
Milford, IN 46542
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Maple Grove Amish School",'Milford=' + Milford.length); Warsaw[Warsaw.length] = createMarker(new GPoint(-85.77958600,41.22594500),"
Monarch Christian Academy
744 S 325 E
Warsaw, IN 46582
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Monarch Christian Academy",'Warsaw=' + Warsaw.length); Nappanee[Nappanee.length] = createMarker(new GPoint(-86.02517700,41.38443400),"
Pleasant Valley School
9324 W 1050 N
Nappanee, IN 46550
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Pleasant Valley School",'Nappanee=' + Nappanee.length); Etna_Green[Etna_Green.length] = createMarker(new GPoint(-85.99661600,41.32401200),"
Pleasant View School
7849 W 640 N
Etna Green, IN 46524
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Pleasant View School",'Etna_Green=' + Etna_Green.length); Warsaw[Warsaw.length] = createMarker(new GPoint(-85.82918200,41.23842600),"
Sacred Heart Elementary School
135 N Harrison Street
Warsaw, IN 46580
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Sacred Heart Elementary School",'Warsaw=' + Warsaw.length); Etna_Green[Etna_Green.length] = createMarker(new GPoint(-85.99976800,41.31385500),"
South Millwood Parochial School
7763 N 800 W
Etna Green, IN 46524
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("South Millwood Parochial School",'Etna_Green=' + Etna_Green.length); Nappanee[Nappanee.length] = createMarker(new GPoint(-86.03325600,41.42661400),"
Sunny Meadow Amish School
13996 N 1050 W
Nappanee, IN 46550
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Sunny Meadow Amish School",'Nappanee=' + Nappanee.length); Warsaw[Warsaw.length] = createMarker(new GPoint(-85.85651700,41.22824200),"
Warsaw Christian School
909 S Buffalo Street
Warsaw, IN 46580
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Warsaw Christian School",'Warsaw=' + Warsaw.length); Milford[Milford.length] = createMarker(new GPoint(-85.95542500,41.39078200),"
West Hastings
5630 W 1100 N
Milford, IN 46542
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("West Hastings",'Milford=' + Milford.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(Etna_Green); map.removeOverlays(Milford); map.removeOverlays(Nappanee); map.removeOverlays(North_Manchester); map.removeOverlays(Warsaw); 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(Nappanee);map.removeOverlays(Etna_Green); map.removeOverlays(Milford); map.removeOverlays(Nappanee); map.removeOverlays(North_Manchester); map.removeOverlays(Warsaw); map.addOverlays(Etna_Green); centerByArray(Etna_Green, false, false); cntMarker += Etna_Green.length; map.addOverlays(Milford); centerByArray(Milford, false, false); cntMarker += Milford.length; map.addOverlays(Nappanee); centerByArray(Nappanee, false, false); cntMarker += Nappanee.length; map.addOverlays(North_Manchester); centerByArray(North_Manchester, false, false); cntMarker += North_Manchester.length; map.addOverlays(Warsaw); centerByArray(Warsaw, false, false); cntMarker += Warsaw.length; centerByArray(Nappanee,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; }