function addMarkers(){ mySelect = document.getElementById('selection'); Milton = [];Turbotville = [];Danville = [];Hummels_Wharf = [];Mount_Carmel = [];Watsontown = [];Paxinos = [];Northumberland = [];Coal_Township = [];Shamokin = [];Sunbury = [];Herndon = [];Riverside = [];mySelect.options[mySelect.options.length] = new Option("Coal Township schools",'all=Coal_Township'); mySelect.options[mySelect.options.length] = new Option("Danville schools",'all=Danville'); mySelect.options[mySelect.options.length] = new Option("Herndon schools",'all=Herndon'); mySelect.options[mySelect.options.length] = new Option("Hummels Wharf schools",'all=Hummels_Wharf'); mySelect.options[mySelect.options.length] = new Option("Milton schools",'all=Milton'); mySelect.options[mySelect.options.length] = new Option("Mount Carmel schools",'all=Mount_Carmel'); mySelect.options[mySelect.options.length] = new Option("Northumberland schools",'all=Northumberland'); mySelect.options[mySelect.options.length] = new Option("Paxinos schools",'all=Paxinos'); mySelect.options[mySelect.options.length] = new Option("Riverside schools",'all=Riverside'); mySelect.options[mySelect.options.length] = new Option("Shamokin schools",'all=Shamokin'); mySelect.options[mySelect.options.length] = new Option("Sunbury schools",'all=Sunbury'); mySelect.options[mySelect.options.length] = new Option("Turbotville schools",'all=Turbotville'); mySelect.options[mySelect.options.length] = new Option("Watsontown schools",'all=Watsontown'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Milton[Milton.length] = createMarker(new GPoint(-76.85723400,41.01513900),"
Bethesda Prep School
49 Lower Market Street
Milton, PA 17847
Co-ed school, 6-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bethesda Prep School",'Milton=' + Milton.length); Turbotville[Turbotville.length] = createMarker(new GPoint(-76.71636000,41.12948300),"
Creek Side School
143 Hickory Road
Turbotville, PA 17772
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Creek Side School",'Turbotville=' + Turbotville.length); Danville[Danville.length] = createMarker(new GPoint(-76.62288800,40.95494000),"
Danville Mennonite School
422 Elysburg Road
Danville, PA 17821
Co-ed school, 1-10
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Danville Mennonite School",'Danville=' + Danville.length); Hummels_Wharf[Hummels_Wharf.length] = createMarker(new GPoint(-76.83610000,40.83160000),"
Darul Uloom Al-qasim
Po Box 386
Hummels Wharf, PA 17831
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Darul Uloom Al-qasim",'Hummels_Wharf=' + Hummels_Wharf.length); Mount_Carmel[Mount_Carmel.length] = createMarker(new GPoint(-76.41585500,40.79851600),"
Holy Spirit Elementary School
250 West Avenue
Mount Carmel, PA 17851
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Holy Spirit Elementary School",'Mount_Carmel=' + Mount_Carmel.length); Watsontown[Watsontown.length] = createMarker(new GPoint(-76.84770000,41.10070000),"
Keefertown Parochial School
2165 Whitmoyer Road
Watsontown, PA 17777
Co-ed school, 1-9
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Keefertown Parochial School",'Watsontown=' + Watsontown.length); Watsontown[Watsontown.length] = createMarker(new GPoint(-76.79040000,41.07930000),"
Maranatha Mennonite Christian School
1485 Plotts Road
Watsontown, PA 17777
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Maranatha Mennonite Christian School",'Watsontown=' + Watsontown.length); Milton[Milton.length] = createMarker(new GPoint(-76.81785800,41.02354500),"
Meadowbrook Christian School
363 Stamm Road
Milton, PA 17847
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Meadowbrook Christian School",'Milton=' + Milton.length); Paxinos[Paxinos.length] = createMarker(new GPoint(-76.63097300,40.82710200),"
Meadowview Christian Academy
Rr 2 Box 418
Paxinos, PA 17860
Co-ed school, PK-9
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Meadowview Christian Academy",'Paxinos=' + Paxinos.length); Northumberland[Northumberland.length] = createMarker(new GPoint(-76.80014400,40.89418700),"
Northumberland Chr School
351 5th Street
Northumberland, PA 17857
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Northumberland Chr School",'Northumberland=' + Northumberland.length); Coal_Township[Coal_Township.length] = createMarker(new GPoint(-76.56456700,40.78720800),"
Northwestern Academy
2000 Northwestern Drive
Coal Township, PA 17866
Co-ed school, 6-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Northwestern Academy",'Coal_Township=' + Coal_Township.length); Coal_Township[Coal_Township.length] = createMarker(new GPoint(-76.56573100,40.78753700),"
Queen Of Peace Cons School
821 W Chestnut Street
Coal Township, PA 17866
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Queen Of Peace Cons School",'Coal_Township=' + Coal_Township.length); Shamokin[Shamokin.length] = createMarker(new GPoint(-76.55101800,40.78944200),"
Queen Of Peace School
201 N Shamokin Street
Shamokin, PA 17872
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Queen Of Peace School",'Shamokin=' + Shamokin.length); Sunbury[Sunbury.length] = createMarker(new GPoint(-76.79641500,40.86269000),"
St. Monica School
109 Market Street
Sunbury, PA 17801
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Monica School",'Sunbury=' + Sunbury.length); Herndon[Herndon.length] = createMarker(new GPoint(-76.82838000,40.72514000),"
Schwaben Creek School
Rr 2 Box 365
Herndon, PA 17830
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Schwaben Creek School",'Herndon=' + Herndon.length); Watsontown[Watsontown.length] = createMarker(new GPoint(-76.85434000,41.10502000),"
Spring View Parochial School
Seagrave Rd
Watsontown, PA 17777
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Spring View Parochial School",'Watsontown=' + Watsontown.length); Northumberland[Northumberland.length] = createMarker(new GPoint(-76.76243300,40.91267500),"
Sunbury Christian Academy
135 Spruce Hollow Road
Northumberland, PA 17857
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Sunbury Christian Academy",'Northumberland=' + Northumberland.length); Turbotville[Turbotville.length] = createMarker(new GPoint(-76.84770000,41.10070000),"
Sunny Slope Amish Parochial School
1020 Comly Road
Turbotville, PA 17772
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Sunny Slope Amish Parochial School",'Turbotville=' + Turbotville.length); Riverside[Riverside.length] = createMarker(new GPoint(-76.63311900,40.95602900),"
Susquehanna Bible Academy
Po Box 455
Riverside, PA 17868
Co-ed school, 3-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Susquehanna Bible Academy",'Riverside=' + Riverside.length); Shamokin[Shamokin.length] = createMarker(new GPoint(-76.55108100,40.78884700),"
Transfiguration Elementary School
129 N Shamokin Street
Shamokin, PA 17872
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Transfiguration Elementary School",'Shamokin=' + Shamokin.length); Watsontown[Watsontown.length] = createMarker(new GPoint(-76.85161600,41.10034300),"
Watsontown Christian Academy
1225 Eighth Street Dr.
Watsontown, PA 17777
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Watsontown Christian Academy",'Watsontown=' + Watsontown.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(Coal_Township); map.removeOverlays(Danville); map.removeOverlays(Herndon); map.removeOverlays(Hummels_Wharf); map.removeOverlays(Milton); map.removeOverlays(Mount_Carmel); map.removeOverlays(Northumberland); map.removeOverlays(Paxinos); map.removeOverlays(Riverside); map.removeOverlays(Shamokin); map.removeOverlays(Sunbury); map.removeOverlays(Turbotville); map.removeOverlays(Watsontown); 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(Milton);map.removeOverlays(Coal_Township); map.removeOverlays(Danville); map.removeOverlays(Herndon); map.removeOverlays(Hummels_Wharf); map.removeOverlays(Milton); map.removeOverlays(Mount_Carmel); map.removeOverlays(Northumberland); map.removeOverlays(Paxinos); map.removeOverlays(Riverside); map.removeOverlays(Shamokin); map.removeOverlays(Sunbury); map.removeOverlays(Turbotville); map.removeOverlays(Watsontown); map.addOverlays(Coal_Township); centerByArray(Coal_Township, false, false); cntMarker += Coal_Township.length; map.addOverlays(Danville); centerByArray(Danville, false, false); cntMarker += Danville.length; map.addOverlays(Herndon); centerByArray(Herndon, false, false); cntMarker += Herndon.length; map.addOverlays(Hummels_Wharf); centerByArray(Hummels_Wharf, false, false); cntMarker += Hummels_Wharf.length; map.addOverlays(Milton); centerByArray(Milton, false, false); cntMarker += Milton.length; map.addOverlays(Mount_Carmel); centerByArray(Mount_Carmel, false, false); cntMarker += Mount_Carmel.length; map.addOverlays(Northumberland); centerByArray(Northumberland, false, false); cntMarker += Northumberland.length; map.addOverlays(Paxinos); centerByArray(Paxinos, false, false); cntMarker += Paxinos.length; map.addOverlays(Riverside); centerByArray(Riverside, false, false); cntMarker += Riverside.length; map.addOverlays(Shamokin); centerByArray(Shamokin, false, false); cntMarker += Shamokin.length; map.addOverlays(Sunbury); centerByArray(Sunbury, false, false); cntMarker += Sunbury.length; map.addOverlays(Turbotville); centerByArray(Turbotville, false, false); cntMarker += Turbotville.length; map.addOverlays(Watsontown); centerByArray(Watsontown, false, false); cntMarker += Watsontown.length; centerByArray(Milton,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; }