function addMarkers(){ mySelect = document.getElementById('selection'); Jamestown = [];Mayville = [];Dewittville = [];Cherry_Creek = [];Dunkirk = [];Sherman = [];Panama = [];Forestville = [];Brocton = [];Cassadaga = [];Clymer = [];Conewango_Valley = [];mySelect.options[mySelect.options.length] = new Option("Brocton schools",'all=Brocton'); mySelect.options[mySelect.options.length] = new Option("Cassadaga schools",'all=Cassadaga'); mySelect.options[mySelect.options.length] = new Option("Cherry Creek schools",'all=Cherry_Creek'); mySelect.options[mySelect.options.length] = new Option("Clymer schools",'all=Clymer'); mySelect.options[mySelect.options.length] = new Option("Conewango Valley schools",'all=Conewango_Valley'); mySelect.options[mySelect.options.length] = new Option("Dewittville schools",'all=Dewittville'); mySelect.options[mySelect.options.length] = new Option("Dunkirk schools",'all=Dunkirk'); mySelect.options[mySelect.options.length] = new Option("Forestville schools",'all=Forestville'); mySelect.options[mySelect.options.length] = new Option("Jamestown schools",'all=Jamestown'); mySelect.options[mySelect.options.length] = new Option("Mayville schools",'all=Mayville'); mySelect.options[mySelect.options.length] = new Option("Panama schools",'all=Panama'); mySelect.options[mySelect.options.length] = new Option("Sherman schools",'all=Sherman'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Jamestown[Jamestown.length] = createMarker(new GPoint(-79.27476700,42.09005200),"
Bethel Baptist Christian Academy
200 Hunt Road
Jamestown, NY 14701
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bethel Baptist Christian Academy",'Jamestown=' + Jamestown.length); Mayville[Mayville.length] = createMarker(new GPoint(-79.46288600,42.29392300),"
Burdick Rd. Amish School
6604 Burdick Rd
Mayville, NY 14757
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Burdick Rd. Amish School",'Mayville=' + Mayville.length); Dewittville[Dewittville.length] = createMarker(new GPoint(-79.46088600,42.31148600),"
Burdick Rd. Amish School
7095 Burdick Road
Dewittville, NY 14728
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Burdick Rd. Amish School",'Dewittville=' + Dewittville.length); Cherry_Creek[Cherry_Creek.length] = createMarker(new GPoint(-79.13520000,42.30350000),"
Caldwell School
Bentley Hill Road
Cherry Creek, NY 14723
Co-ed school, 1-7
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Caldwell School",'Cherry_Creek=' + Cherry_Creek.length); Dunkirk[Dunkirk.length] = createMarker(new GPoint(-79.33307400,42.47041700),"
Central Christian Academy
876 Central Avenue
Dunkirk, NY 14048
Co-ed school, NS-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Central Christian Academy",'Dunkirk=' + Dunkirk.length); Sherman[Sherman.length] = createMarker(new GPoint(-79.58618000,42.13462000),"
Clear View School
3170 Route 76
Sherman, NY 14781
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Clear View School",'Sherman=' + Sherman.length); Panama[Panama.length] = createMarker(new GPoint(-79.52800400,42.03550400),"
Clover Hill School
883 Weeks Road
Panama, NY 14767
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Clover Hill School",'Panama=' + Panama.length); Forestville[Forestville.length] = createMarker(new GPoint(-79.17654200,42.46781900),"
Forestville Baptist Chstn Academy
5 Prospect St
Forestville, NY 14062
Co-ed school, KG-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Forestville Baptist Chstn Academy",'Forestville=' + Forestville.length); Jamestown[Jamestown.length] = createMarker(new GPoint(-79.21116800,42.11650700),"
Gustavus Adolphus Learning Center
200 Gustavus Avenue
Jamestown, NY 14701
Co-ed school, 5-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Gustavus Adolphus Learning Center",'Jamestown=' + Jamestown.length); Jamestown[Jamestown.length] = createMarker(new GPoint(-79.24142700,42.10920300),"
Holy Family Catholic School
1135 N Main Street
Jamestown, NY 14701
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Holy Family Catholic School",'Jamestown=' + Jamestown.length); Jamestown[Jamestown.length] = createMarker(new GPoint(-79.26511200,42.09245900),"
Jamestown Sda School
130 Mcdaniel Avenue
Jamestown, NY 14701
Co-ed school, 3-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Jamestown Sda School",'Jamestown=' + Jamestown.length); Brocton[Brocton.length] = createMarker(new GPoint(-79.44111300,42.41248500),"
Lake Erie Baptist Church Academy
9500 Lake Avenue
Brocton, NY 14716
Co-ed school, 6-11
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Lake Erie Baptist Church Academy",'Brocton=' + Brocton.length); Panama[Panama.length] = createMarker(new GPoint(-79.55528900,42.08857500),"
Lake View School
2047 Waits Corners Road
Panama, NY 14767
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Lake View School",'Panama=' + Panama.length); Jamestown[Jamestown.length] = createMarker(new GPoint(-79.21448700,42.08644100),"
Lighthouse Baptist Academy
381 Camp Street
Jamestown, NY 14701
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Lighthouse Baptist Academy",'Jamestown=' + Jamestown.length); Dunkirk[Dunkirk.length] = createMarker(new GPoint(-79.33296200,42.48440700),"
Northern Chautauqua Catholic School
336 Washington Avenue
Dunkirk, NY 14048
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Northern Chautauqua Catholic School",'Dunkirk=' + Dunkirk.length); Cassadaga[Cassadaga.length] = createMarker(new GPoint(-79.29505600,42.31183700),"
Open Door Baptist Academy
3576 Luce Road
Cassadaga, NY 14718
Co-ed school, 1-9
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Open Door Baptist Academy",'Cassadaga=' + Cassadaga.length); Clymer[Clymer.length] = createMarker(new GPoint(-79.57272100,42.07521700),"
Pine View School
Pork Road
Clymer, NY 14724
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Pine View School",'Clymer=' + Clymer.length); Dewittville[Dewittville.length] = createMarker(new GPoint(-79.46075100,42.31555700),"
Pleasant View Amish School
Burdick Road
Dewittville, NY 14728
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Pleasant View Amish School",'Dewittville=' + Dewittville.length); Mayville[Mayville.length] = createMarker(new GPoint(-79.46288600,42.29392300),"
Pleasant View Amish School A Byle
6604 Burdick Rd
Mayville, NY 14757
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Pleasant View Amish School A Byle",'Mayville=' + Mayville.length); Dunkirk[Dunkirk.length] = createMarker(new GPoint(-79.31975800,42.49202700),"
St. Hyacinth School
296 Lake Shore Drive E
Dunkirk, NY 14048
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Hyacinth School",'Dunkirk=' + Dunkirk.length); Sherman[Sherman.length] = createMarker(new GPoint(-79.60110000,42.15800000),"
Valley View Amish School
2384 Clymer Sherman Road
Sherman, NY 14781
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Valley View Amish School",'Sherman=' + Sherman.length); Conewango_Valley[Conewango_Valley.length] = createMarker(new GPoint(-79.00230000,42.25210000),"
West Road School
West Road
Conewango Valley, NY 14726
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("West Road School",'Conewango_Valley=' + Conewango_Valley.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(Brocton); map.removeOverlays(Cassadaga); map.removeOverlays(Cherry_Creek); map.removeOverlays(Clymer); map.removeOverlays(Conewango_Valley); map.removeOverlays(Dewittville); map.removeOverlays(Dunkirk); map.removeOverlays(Forestville); map.removeOverlays(Jamestown); map.removeOverlays(Mayville); map.removeOverlays(Panama); map.removeOverlays(Sherman); 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(Jamestown);map.removeOverlays(Brocton); map.removeOverlays(Cassadaga); map.removeOverlays(Cherry_Creek); map.removeOverlays(Clymer); map.removeOverlays(Conewango_Valley); map.removeOverlays(Dewittville); map.removeOverlays(Dunkirk); map.removeOverlays(Forestville); map.removeOverlays(Jamestown); map.removeOverlays(Mayville); map.removeOverlays(Panama); map.removeOverlays(Sherman); map.addOverlays(Brocton); centerByArray(Brocton, false, false); cntMarker += Brocton.length; map.addOverlays(Cassadaga); centerByArray(Cassadaga, false, false); cntMarker += Cassadaga.length; map.addOverlays(Cherry_Creek); centerByArray(Cherry_Creek, false, false); cntMarker += Cherry_Creek.length; map.addOverlays(Clymer); centerByArray(Clymer, false, false); cntMarker += Clymer.length; map.addOverlays(Conewango_Valley); centerByArray(Conewango_Valley, false, false); cntMarker += Conewango_Valley.length; map.addOverlays(Dewittville); centerByArray(Dewittville, false, false); cntMarker += Dewittville.length; map.addOverlays(Dunkirk); centerByArray(Dunkirk, false, false); cntMarker += Dunkirk.length; map.addOverlays(Forestville); centerByArray(Forestville, false, false); cntMarker += Forestville.length; map.addOverlays(Jamestown); centerByArray(Jamestown, false, false); cntMarker += Jamestown.length; map.addOverlays(Mayville); centerByArray(Mayville, false, false); cntMarker += Mayville.length; map.addOverlays(Panama); centerByArray(Panama, false, false); cntMarker += Panama.length; map.addOverlays(Sherman); centerByArray(Sherman, false, false); cntMarker += Sherman.length; centerByArray(Jamestown,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; }