function addMarkers(){ mySelect = document.getElementById('selection'); Stroudsburg = [];Pocono_Pines = [];East_Stroudsburg = [];Mountainhome = [];Tannersville = [];Effort = [];Cresco = [];Swiftwater = [];E_Stroudsburg = [];Shawnee_On_Delaware = [];Tobyhanna = [];mySelect.options[mySelect.options.length] = new Option("Cresco schools",'all=Cresco'); mySelect.options[mySelect.options.length] = new Option("E Stroudsburg schools",'all=E_Stroudsburg'); mySelect.options[mySelect.options.length] = new Option("East Stroudsburg schools",'all=East_Stroudsburg'); mySelect.options[mySelect.options.length] = new Option("Effort schools",'all=Effort'); mySelect.options[mySelect.options.length] = new Option("Mountainhome schools",'all=Mountainhome'); mySelect.options[mySelect.options.length] = new Option("Pocono Pines schools",'all=Pocono_Pines'); mySelect.options[mySelect.options.length] = new Option("Shawnee On Delaware schools",'all=Shawnee_On_Delaware'); mySelect.options[mySelect.options.length] = new Option("Stroudsburg schools",'all=Stroudsburg'); mySelect.options[mySelect.options.length] = new Option("Swiftwater schools",'all=Swiftwater'); mySelect.options[mySelect.options.length] = new Option("Tannersville schools",'all=Tannersville'); mySelect.options[mySelect.options.length] = new Option("Tobyhanna schools",'all=Tobyhanna'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Stroudsburg[Stroudsburg.length] = createMarker(new GPoint(-75.19078100,40.98808600),"
Calvary Baptist Christian School
Rr 4 Box 4189
Stroudsburg, PA 18360
Co-ed school, K-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Calvary Baptist Christian School",'Stroudsburg=' + Stroudsburg.length); Pocono_Pines[Pocono_Pines.length] = createMarker(new GPoint(-75.46036900,41.10803200),"
Character Builders Christian Academy
Po Box 179 Sullivan Trail
Pocono Pines, PA 18350
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Character Builders Christian Academy",'Pocono_Pines=' + Pocono_Pines.length); Stroudsburg[Stroudsburg.length] = createMarker(new GPoint(-75.19394500,40.99689400),"
Creative Learning Center
915 N 5th Street
Stroudsburg, PA 18360
Co-ed school, NS-PK
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Creative Learning Center",'Stroudsburg=' + Stroudsburg.length); East_Stroudsburg[East_Stroudsburg.length] = createMarker(new GPoint(-75.31845700,40.90354300),"
E Stroudsburg Christian Academy
Po Box 208
East Stroudsburg, PA 18301
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("E Stroudsburg Christian Academy",'East_Stroudsburg=' + East_Stroudsburg.length); Mountainhome[Mountainhome.length] = createMarker(new GPoint(-75.27242600,41.16943800),"
Evergreen Community School
Po Box 523
Mountainhome, PA 18342
Co-ed school, 6-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Evergreen Community School",'Mountainhome=' + Mountainhome.length); Tannersville[Tannersville.length] = createMarker(new GPoint(-75.32420000,41.04940000),"
Growing Concern School
Po Box 828
Tannersville, PA 18372
Co-ed school, PK-5
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Growing Concern School",'Tannersville=' + Tannersville.length); Effort[Effort.length] = createMarker(new GPoint(-75.44424900,40.96822300),"
Liberty Faith Country Day School
2623 Route 115
Effort, PA 18330
Co-ed school, PK-11
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Liberty Faith Country Day School",'Effort=' + Effort.length); Cresco[Cresco.length] = createMarker(new GPoint(-75.21930000,41.15330000),"
Msgr Mc Hugh Elementary School
Rr 1 Box 1780
Cresco, PA 18326
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Msgr Mc Hugh Elementary School",'Cresco=' + Cresco.length); East_Stroudsburg[East_Stroudsburg.length] = createMarker(new GPoint(-75.18044800,40.99433600),"
Notre Dame Elementary School
78 Ridgeway Street
East Stroudsburg, PA 18301
Co-ed school, PK-4
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Notre Dame Elementary School",'East_Stroudsburg=' + East_Stroudsburg.length); Swiftwater[Swiftwater.length] = createMarker(new GPoint(-75.35830000,41.08630000),"
Oxford School
Po Box 67
Swiftwater, PA 18370
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Oxford School",'Swiftwater=' + Swiftwater.length); E_Stroudsburg[E_Stroudsburg.length] = createMarker(new GPoint(-75.19370000,41.02220000),"
St. Paul's Lutheran School
Rd2 Box 2157
E Stroudsburg, PA 18301
Co-ed school, PK-5
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Paul's Lutheran School",'E_Stroudsburg=' + E_Stroudsburg.length); Shawnee_On_Delaware[Shawnee_On_Delaware.length] = createMarker(new GPoint(-75.11120000,41.00940000),"
Shawnee Academy
Po Box 554
Shawnee On Delaware, PA 18356
Co-ed school, 2-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Shawnee Academy",'Shawnee_On_Delaware=' + Shawnee_On_Delaware.length); Stroudsburg[Stroudsburg.length] = createMarker(new GPoint(-75.29540000,40.94410000),"
Stroudsburg Seventh-day Adventist School
Rr 2 Box 2085 West Main Street
Stroudsburg, PA 18360
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Stroudsburg Seventh-day Adventist School",'Stroudsburg=' + Stroudsburg.length); Effort[Effort.length] = createMarker(new GPoint(-75.44520000,40.97680000),"
Tender Treasures Day Care
Route 115 State Road
Effort, PA 18330
Co-ed school, PK-1
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Tender Treasures Day Care",'Effort=' + Effort.length); Tobyhanna[Tobyhanna.length] = createMarker(new GPoint(-75.35824700,41.14688800),"
Tobyhanna Christian Academy
16 Carriage Square
Tobyhanna, PA 18466
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Tobyhanna Christian Academy",'Tobyhanna=' + Tobyhanna.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(Cresco); map.removeOverlays(E_Stroudsburg); map.removeOverlays(East_Stroudsburg); map.removeOverlays(Effort); map.removeOverlays(Mountainhome); map.removeOverlays(Pocono_Pines); map.removeOverlays(Shawnee_On_Delaware); map.removeOverlays(Stroudsburg); map.removeOverlays(Swiftwater); map.removeOverlays(Tannersville); map.removeOverlays(Tobyhanna); 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(Stroudsburg);map.removeOverlays(Cresco); map.removeOverlays(E_Stroudsburg); map.removeOverlays(East_Stroudsburg); map.removeOverlays(Effort); map.removeOverlays(Mountainhome); map.removeOverlays(Pocono_Pines); map.removeOverlays(Shawnee_On_Delaware); map.removeOverlays(Stroudsburg); map.removeOverlays(Swiftwater); map.removeOverlays(Tannersville); map.removeOverlays(Tobyhanna); map.addOverlays(Cresco); centerByArray(Cresco, false, false); cntMarker += Cresco.length; map.addOverlays(E_Stroudsburg); centerByArray(E_Stroudsburg, false, false); cntMarker += E_Stroudsburg.length; map.addOverlays(East_Stroudsburg); centerByArray(East_Stroudsburg, false, false); cntMarker += East_Stroudsburg.length; map.addOverlays(Effort); centerByArray(Effort, false, false); cntMarker += Effort.length; map.addOverlays(Mountainhome); centerByArray(Mountainhome, false, false); cntMarker += Mountainhome.length; map.addOverlays(Pocono_Pines); centerByArray(Pocono_Pines, false, false); cntMarker += Pocono_Pines.length; map.addOverlays(Shawnee_On_Delaware); centerByArray(Shawnee_On_Delaware, false, false); cntMarker += Shawnee_On_Delaware.length; map.addOverlays(Stroudsburg); centerByArray(Stroudsburg, false, false); cntMarker += Stroudsburg.length; map.addOverlays(Swiftwater); centerByArray(Swiftwater, false, false); cntMarker += Swiftwater.length; map.addOverlays(Tannersville); centerByArray(Tannersville, false, false); cntMarker += Tannersville.length; map.addOverlays(Tobyhanna); centerByArray(Tobyhanna, false, false); cntMarker += Tobyhanna.length; centerByArray(Stroudsburg,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; }