function addMarkers(){ mySelect = document.getElementById('selection'); Cattaraugus = [];Yorkshire = [];Conewango_Valley = [];Randolph = [];Gowanda = [];Olean = [];Franklinville = [];Portville = [];mySelect.options[mySelect.options.length] = new Option("Cattaraugus schools",'all=Cattaraugus'); mySelect.options[mySelect.options.length] = new Option("Conewango Valley schools",'all=Conewango_Valley'); mySelect.options[mySelect.options.length] = new Option("Franklinville schools",'all=Franklinville'); mySelect.options[mySelect.options.length] = new Option("Gowanda schools",'all=Gowanda'); mySelect.options[mySelect.options.length] = new Option("Olean schools",'all=Olean'); mySelect.options[mySelect.options.length] = new Option("Portville schools",'all=Portville'); mySelect.options[mySelect.options.length] = new Option("Randolph schools",'all=Randolph'); mySelect.options[mySelect.options.length] = new Option("Yorkshire schools",'all=Yorkshire'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Cattaraugus[Cattaraugus.length] = createMarker(new GPoint(-78.86891500,42.32988800),"
Cattaraugus Christian School
15-17 Main Street
Cattaraugus, NY 14719
Co-ed school, 4-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Cattaraugus Christian School",'Cattaraugus=' + Cattaraugus.length); Yorkshire[Yorkshire.length] = createMarker(new GPoint(-78.47300000,42.53000000),"
Central Baptist Christian School
12045 Old Olean Rd
Yorkshire, NY 14173
Co-ed school, NS-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Central Baptist Christian School",'Yorkshire=' + Yorkshire.length); Conewango_Valley[Conewango_Valley.length] = createMarker(new GPoint(-79.02480000,42.25570000),"
Cherry Hill School
Chicken Rd
Conewango Valley, NY 14726
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Cherry Hill School",'Conewango_Valley=' + Conewango_Valley.length); Conewango_Valley[Conewango_Valley.length] = createMarker(new GPoint(-79.00200000,42.27152000),"
Deer Run School
Town Hill
Conewango Valley, NY 14726
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Deer Run School",'Conewango_Valley=' + Conewango_Valley.length); Conewango_Valley[Conewango_Valley.length] = createMarker(new GPoint(-79.02480000,42.25570000),"
Flat Iron School
Corner Of Flat Iron West Rd.
Conewango Valley, NY 14726
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Flat Iron School",'Conewango_Valley=' + Conewango_Valley.length); Conewango_Valley[Conewango_Valley.length] = createMarker(new GPoint(-79.04571300,42.28546200),"
Gardner School
6580 West Rd
Conewango Valley, NY 14726
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Gardner School",'Conewango_Valley=' + Conewango_Valley.length); Cattaraugus[Cattaraugus.length] = createMarker(new GPoint(-78.92392000,42.24866600),"
Glover Hill Rd Amish School
5721 Glover Hill Road
Cattaraugus, NY 14719
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Glover Hill Rd Amish School",'Cattaraugus=' + Cattaraugus.length); Randolph[Randolph.length] = createMarker(new GPoint(-78.99714000,42.20744000),"
Harris Hill School
Pope Rd.
Randolph, NY 14772
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Harris Hill School",'Randolph=' + Randolph.length); Conewango_Valley[Conewango_Valley.length] = createMarker(new GPoint(-79.02480000,42.25570000),"
Harris School
Harris School Rd
Conewango Valley, NY 14726
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Harris School",'Conewango_Valley=' + Conewango_Valley.length); Gowanda[Gowanda.length] = createMarker(new GPoint(-78.93881300,42.46196600),"
Immanuel Christian School
40 S Chapel Street
Gowanda, NY 14070
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Immanuel Christian School",'Gowanda=' + Gowanda.length); Conewango_Valley[Conewango_Valley.length] = createMarker(new GPoint(-79.02764000,42.26050000),"
Little Run School
Young Rd
Conewango Valley, NY 14726
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Little Run School",'Conewango_Valley=' + Conewango_Valley.length); Conewango_Valley[Conewango_Valley.length] = createMarker(new GPoint(-78.97170000,42.23832000),"
Maple Row School
Harris Rd
Conewango Valley, NY 14726
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Maple Row School",'Conewango_Valley=' + Conewango_Valley.length); Cattaraugus[Cattaraugus.length] = createMarker(new GPoint(-78.91518400,42.24379800),"
Merchant Hill School
Merchant Hill Road
Cattaraugus, NY 14719
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Merchant Hill School",'Cattaraugus=' + Cattaraugus.length); Olean[Olean.length] = createMarker(new GPoint(-78.43468400,42.09177900),"
New Life Christian School
102 West Forest Ave
Olean, NY 14760
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("New Life Christian School",'Olean=' + Olean.length); Franklinville[Franklinville.length] = createMarker(new GPoint(-78.44670400,42.27456700),"
New Life Christian School
6323 Route 16
Franklinville, NY 14737
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("New Life Christian School",'Franklinville=' + Franklinville.length); Conewango_Valley[Conewango_Valley.length] = createMarker(new GPoint(-79.00200000,42.27152000),"
Pineview School
Town Hill Rd
Conewango Valley, NY 14724
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Pineview School",'Conewango_Valley=' + Conewango_Valley.length); Conewango_Valley[Conewango_Valley.length] = createMarker(new GPoint(-79.02480000,42.25570000),"
Pleasant View School
County Rd 6
Conewango Valley, NY 14726
school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Pleasant View School",'Conewango_Valley=' + Conewango_Valley.length); Portville[Portville.length] = createMarker(new GPoint(-78.33852200,42.03908900),"
Portville Baptist Chr School
24 Temple St Box 277
Portville, NY 14770
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Portville Baptist Chr School",'Portville=' + Portville.length); Conewango_Valley[Conewango_Valley.length] = createMarker(new GPoint(-78.98334000,42.23860000),"
Seager Hill School
Seager Hill Rd
Conewango Valley, NY 14726
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Seager Hill School",'Conewango_Valley=' + Conewango_Valley.length); Olean[Olean.length] = createMarker(new GPoint(-78.43171700,42.07536300),"
Southern Tier Catholic School
205 West Henley Street
Olean, NY 14760
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Southern Tier Catholic School",'Olean=' + Olean.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(Cattaraugus); map.removeOverlays(Conewango_Valley); map.removeOverlays(Franklinville); map.removeOverlays(Gowanda); map.removeOverlays(Olean); map.removeOverlays(Portville); map.removeOverlays(Randolph); map.removeOverlays(Yorkshire); 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(Cattaraugus);map.removeOverlays(Cattaraugus); map.removeOverlays(Conewango_Valley); map.removeOverlays(Franklinville); map.removeOverlays(Gowanda); map.removeOverlays(Olean); map.removeOverlays(Portville); map.removeOverlays(Randolph); map.removeOverlays(Yorkshire); map.addOverlays(Cattaraugus); centerByArray(Cattaraugus, false, false); cntMarker += Cattaraugus.length; map.addOverlays(Conewango_Valley); centerByArray(Conewango_Valley, false, false); cntMarker += Conewango_Valley.length; map.addOverlays(Franklinville); centerByArray(Franklinville, false, false); cntMarker += Franklinville.length; map.addOverlays(Gowanda); centerByArray(Gowanda, false, false); cntMarker += Gowanda.length; map.addOverlays(Olean); centerByArray(Olean, false, false); cntMarker += Olean.length; map.addOverlays(Portville); centerByArray(Portville, false, false); cntMarker += Portville.length; map.addOverlays(Randolph); centerByArray(Randolph, false, false); cntMarker += Randolph.length; map.addOverlays(Yorkshire); centerByArray(Yorkshire, false, false); cntMarker += Yorkshire.length; centerByArray(Cattaraugus,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; }