function addMarkers() { mySelect = document.getElementById('selection'); New_Milford = [];Friendsville = [];Dimock = [];Forest_City = [];Montrose = [];Kingsley = [];Susquehanna = [];mySelect.options[mySelect.options.length] = new Option("Dimock schools",'all=Dimock'); mySelect.options[mySelect.options.length] = new Option("Forest City schools",'all=Forest_City'); mySelect.options[mySelect.options.length] = new Option("Friendsville schools",'all=Friendsville'); mySelect.options[mySelect.options.length] = new Option("Kingsley schools",'all=Kingsley'); mySelect.options[mySelect.options.length] = new Option("Montrose schools",'all=Montrose'); mySelect.options[mySelect.options.length] = new Option("New Milford schools",'all=New_Milford'); mySelect.options[mySelect.options.length] = new Option("Susquehanna schools",'all=Susquehanna'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); New_Milford[New_Milford.length] = createMarker(new GPoint(-75.71620178,41.86420059),"
Blue Ridge Elementary School
Rr 3 Box 220
New Milford, PA 18834

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Blue Ridge Elementary School",'New_Milford=' + New_Milford.length); New_Milford[New_Milford.length] = createMarker(new GPoint(-75.71620178,41.86420059),"
Blue Ridge High School
Rr 3 Box 220
New Milford, PA 18834

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Blue Ridge High School",'New_Milford=' + New_Milford.length); New_Milford[New_Milford.length] = createMarker(new GPoint(-75.71620178,41.86420059),"
Blue Ridge Middle School
Rr 3 Box 220
New Milford, PA 18834

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Blue Ridge Middle School",'New_Milford=' + New_Milford.length); Friendsville[Friendsville.length] = createMarker(new GPoint(-76.06490326,41.89350128),"
Choconut Valley Elementary School
Rr 1 Box 1730
Friendsville, PA 18818

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Choconut Valley Elementary School",'Friendsville=' + Friendsville.length); Dimock[Dimock.length] = createMarker(new GPoint(-75.89859772,41.74629974),"
Elk Lake Elementary School
1 Schoolhouse Rd Po Box 100
Dimock, PA 18816

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Elk Lake Elementary School",'Dimock=' + Dimock.length); Dimock[Dimock.length] = createMarker(new GPoint(-75.89859772,41.74629974),"
Elk Lake Junior Senior High School
Po Box 100
Dimock, PA 18816

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Elk Lake Junior Senior High School",'Dimock=' + Dimock.length); Forest_City[Forest_City.length] = createMarker(new GPoint(-75.47267914,41.64422607),"
Forest City Regional Elementary School
100 Susquehanna St
Forest City, PA 18421

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Forest City Regional Elementary School",'Forest_City=' + Forest_City.length); Forest_City[Forest_City.length] = createMarker(new GPoint(-75.47267914,41.64422607),"
Forest City Regional High School
100 Susquehanna St
Forest City, PA 18421

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Forest City Regional High School",'Forest_City=' + Forest_City.length); Montrose[Montrose.length] = createMarker(new GPoint(-75.87220001,41.83300018),"
Lathrop Street Elementary School
14 Lathrop St
Montrose, PA 18801

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lathrop Street Elementary School",'Montrose=' + Montrose.length); Montrose[Montrose.length] = createMarker(new GPoint(-75.84554291,41.84067917),"
Montrose Area Junior Senior High School
50 High School Rd
Montrose, PA 18801

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Montrose Area Junior Senior High School",'Montrose=' + Montrose.length); Kingsley[Kingsley.length] = createMarker(new GPoint(-75.78269958,41.76259995),"
Mountain View Elementary School
Rr 1 Box 339a
Kingsley, PA 18826

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mountain View Elementary School",'Kingsley=' + Kingsley.length); Kingsley[Kingsley.length] = createMarker(new GPoint(-75.78269958,41.76259995),"
Mountain View Junior Senior High School
Rr 1 Box 339
Kingsley, PA 18826

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mountain View Junior Senior High School",'Kingsley=' + Kingsley.length); Susquehanna[Susquehanna.length] = createMarker(new GPoint(-75.60780334,41.95190048),"
Susquehanna Community Elementary School
Rr 3 Box 5a
Susquehanna, PA 18847

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Susquehanna Community Elementary School",'Susquehanna=' + Susquehanna.length); Susquehanna[Susquehanna.length] = createMarker(new GPoint(-75.60780334,41.95190048),"
Susquehanna Community Junior Senior High School
Rr 3 Box 5a
Susquehanna, PA 18847

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Susquehanna Community Junior Senior High School",'Susquehanna=' + Susquehanna.length); Dimock[Dimock.length] = createMarker(new GPoint(-75.89859772,41.74629974),"
Susquehanna County Ctc
Po Box 100
Dimock, PA 18816

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Susquehanna County Ctc",'Dimock=' + Dimock.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,10); /* 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////' + showArray); map.removeOverlays(Dimock); map.removeOverlays(Forest_City); map.removeOverlays(Friendsville); map.removeOverlays(Kingsley); map.removeOverlays(Montrose); map.removeOverlays(New_Milford); map.removeOverlays(Susquehanna); 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(New_Milford);map.removeOverlays(Dimock); map.removeOverlays(Forest_City); map.removeOverlays(Friendsville); map.removeOverlays(Kingsley); map.removeOverlays(Montrose); map.removeOverlays(New_Milford); map.removeOverlays(Susquehanna); map.addOverlays(Dimock); centerByArray(Dimock, false, false); cntMarker += Dimock.length; map.addOverlays(Forest_City); centerByArray(Forest_City, false, false); cntMarker += Forest_City.length; map.addOverlays(Friendsville); centerByArray(Friendsville, false, false); cntMarker += Friendsville.length; map.addOverlays(Kingsley); centerByArray(Kingsley, false, false); cntMarker += Kingsley.length; map.addOverlays(Montrose); centerByArray(Montrose, false, false); cntMarker += Montrose.length; map.addOverlays(New_Milford); centerByArray(New_Milford, false, false); cntMarker += New_Milford.length; map.addOverlays(Susquehanna); centerByArray(Susquehanna, false, false); cntMarker += Susquehanna.length; centerByArray(New_Milford,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'); } }