function addMarkers(){ mySelect = document.getElementById('selection'); Friedens = [];Somerset = [];Springs = [];Johnstown = [];Meyersdale = [];Hollsopple = [];Salisbury = [];mySelect.options[mySelect.options.length] = new Option("Friedens schools",'all=Friedens'); mySelect.options[mySelect.options.length] = new Option("Hollsopple schools",'all=Hollsopple'); mySelect.options[mySelect.options.length] = new Option("Johnstown schools",'all=Johnstown'); mySelect.options[mySelect.options.length] = new Option("Meyersdale schools",'all=Meyersdale'); mySelect.options[mySelect.options.length] = new Option("Salisbury schools",'all=Salisbury'); mySelect.options[mySelect.options.length] = new Option("Somerset schools",'all=Somerset'); mySelect.options[mySelect.options.length] = new Option("Springs schools",'all=Springs'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Friedens[Friedens.length] = createMarker(new GPoint(-78.89144900,40.01104100),"
Address Correct
1541 Cornerstone Rd
Friedens, PA 15541
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Address Correct",'Friedens=' + Friedens.length); Somerset[Somerset.length] = createMarker(new GPoint(-79.07304900,40.01876300),"
Apostolic Christian Academy
141 Forward Blvd
Somerset, PA 15501
Co-ed school, 1-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Apostolic Christian Academy",'Somerset=' + Somerset.length); Friedens[Friedens.length] = createMarker(new GPoint(-78.89109100,40.01084200),"
Cherry Lane School
1541 Corner Stone Road
Friedens, PA 15541
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Cherry Lane School",'Friedens=' + Friedens.length); Springs[Springs.length] = createMarker(new GPoint(-79.11659000,39.74243600),"
Cross Road Special School
761 Springs Road
Springs, PA 15562
Co-ed school, 3-5
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Cross Road Special School",'Springs=' + Springs.length); Springs[Springs.length] = createMarker(new GPoint(-79.11659000,39.74243600),"
Cross Roads School
664 Springs Road
Springs, PA 15562
Co-ed school, 1-9
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Cross Roads School",'Springs=' + Springs.length); Johnstown[Johnstown.length] = createMarker(new GPoint(-78.92541300,40.24290800),"
Davidsville Christian School
197 Pender Road
Johnstown, PA 15905
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Davidsville Christian School",'Johnstown=' + Johnstown.length); Meyersdale[Meyersdale.length] = createMarker(new GPoint(-79.07096900,39.81320200),"
Greenville Parochial School
Warrens Mill Road
Meyersdale, PA 15552
Co-ed school, 2-9
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Greenville Parochial School",'Meyersdale=' + Meyersdale.length); Meyersdale[Meyersdale.length] = createMarker(new GPoint(-78.95927500,39.72466200),"
Greenville Parochial Scool
380 Hemlock Lane
Meyersdale, PA 15552
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Greenville Parochial Scool",'Meyersdale=' + Meyersdale.length); Meyersdale[Meyersdale.length] = createMarker(new GPoint(-79.09294200,39.78962200),"
Hidden Valley School
161 Hidden Valley Dr
Meyersdale, PA 15552
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Hidden Valley School",'Meyersdale=' + Meyersdale.length); Hollsopple[Hollsopple.length] = createMarker(new GPoint(-78.95196500,40.25001700),"
Johnstown Christian School
125 Christian School Road
Hollsopple, PA 15935
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Johnstown Christian School",'Hollsopple=' + Hollsopple.length); Meyersdale[Meyersdale.length] = createMarker(new GPoint(-79.07096900,39.81320200),"
Meadowbrook Parochial School
7012 Mt Davis Road
Meyersdale, PA 15552
school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Meadowbrook Parochial School",'Meyersdale=' + Meyersdale.length); Springs[Springs.length] = createMarker(new GPoint(-79.15030000,39.73248600),"
Mountain View Christian School
1751 Springs Road
Springs, PA 15562
Co-ed school, 1-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mountain View Christian School",'Springs=' + Springs.length); Somerset[Somerset.length] = createMarker(new GPoint(-79.05869300,40.02072500),"
Somerset Christian School
708 Stoystown Rd Suite 2
Somerset, PA 15501
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Somerset Christian School",'Somerset=' + Somerset.length); Somerset[Somerset.length] = createMarker(new GPoint(-79.11540000,40.02720000),"
St Peter Elementary School
433 W Church Street
Somerset, PA 15501
Co-ed school, 1-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Peter Elementary School",'Somerset=' + Somerset.length); Friedens[Friedens.length] = createMarker(new GPoint(-78.87697900,40.00343000),"
Stonybrook Parochial School
260 Stonybrook Road
Friedens, PA 15541
Co-ed school, 1-9
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Stonybrook Parochial School",'Friedens=' + Friedens.length); Salisbury[Salisbury.length] = createMarker(new GPoint(-79.14203200,39.77548600),"
Sugar Grove School
674 Comptons Mill Rd
Salisbury, PA 25551
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Sugar Grove School",'Salisbury=' + Salisbury.length); Meyersdale[Meyersdale.length] = createMarker(new GPoint(-79.07674000,39.80802000),"
Summit Mills Parochial School
7012 Mount Davis Road
Meyersdale, PA 15552
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Summit Mills Parochial School",'Meyersdale=' + Meyersdale.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(Friedens); map.removeOverlays(Hollsopple); map.removeOverlays(Johnstown); map.removeOverlays(Meyersdale); map.removeOverlays(Salisbury); map.removeOverlays(Somerset); map.removeOverlays(Springs); 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(Friedens);map.removeOverlays(Friedens); map.removeOverlays(Hollsopple); map.removeOverlays(Johnstown); map.removeOverlays(Meyersdale); map.removeOverlays(Salisbury); map.removeOverlays(Somerset); map.removeOverlays(Springs); map.addOverlays(Friedens); centerByArray(Friedens, false, false); cntMarker += Friedens.length; map.addOverlays(Hollsopple); centerByArray(Hollsopple, false, false); cntMarker += Hollsopple.length; map.addOverlays(Johnstown); centerByArray(Johnstown, false, false); cntMarker += Johnstown.length; map.addOverlays(Meyersdale); centerByArray(Meyersdale, false, false); cntMarker += Meyersdale.length; map.addOverlays(Salisbury); centerByArray(Salisbury, false, false); cntMarker += Salisbury.length; map.addOverlays(Somerset); centerByArray(Somerset, false, false); cntMarker += Somerset.length; map.addOverlays(Springs); centerByArray(Springs, false, false); cntMarker += Springs.length; centerByArray(Friedens,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; }