function addMarkers(){ mySelect = document.getElementById('selection'); Kent = [];Aultman = [];Homer_City = [];Clymer = [];Penn_Run = [];Smicksburg = [];Shelocta = [];Home = [];Dixonville = [];Indiana = [];Punxsutawney = [];Marion_Center = [];Rochester_Mills = [];mySelect.options[mySelect.options.length] = new Option("Aultman schools",'all=Aultman'); mySelect.options[mySelect.options.length] = new Option("Clymer schools",'all=Clymer'); mySelect.options[mySelect.options.length] = new Option("Dixonville schools",'all=Dixonville'); mySelect.options[mySelect.options.length] = new Option("Home schools",'all=Home'); mySelect.options[mySelect.options.length] = new Option("Homer City schools",'all=Homer_City'); mySelect.options[mySelect.options.length] = new Option("Indiana schools",'all=Indiana'); mySelect.options[mySelect.options.length] = new Option("Kent schools",'all=Kent'); mySelect.options[mySelect.options.length] = new Option("Marion Center schools",'all=Marion_Center'); mySelect.options[mySelect.options.length] = new Option("Penn Run schools",'all=Penn_Run'); mySelect.options[mySelect.options.length] = new Option("Punxsutawney schools",'all=Punxsutawney'); mySelect.options[mySelect.options.length] = new Option("Rochester Mills schools",'all=Rochester_Mills'); mySelect.options[mySelect.options.length] = new Option("Shelocta schools",'all=Shelocta'); mySelect.options[mySelect.options.length] = new Option("Smicksburg schools",'all=Smicksburg'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Kent[Kent.length] = createMarker(new GPoint(-79.28072300,40.54165900),"
Aultman Baptist Church Academy
Po Box 53
Kent, PA 15752
Co-ed school, 6-11
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Aultman Baptist Church Academy",'Kent=' + Kent.length); Aultman[Aultman.length] = createMarker(new GPoint(-79.25970000,40.56240000),"
Aultman Baptist Church Academy
91 4th Street
Aultman, PA 15713
Co-ed school, K-11
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Aultman Baptist Church Academy",'Aultman=' + Aultman.length); Homer_City[Homer_City.length] = createMarker(new GPoint(-79.08820400,40.49150300),"
Breezy Lane School
9097 Route 259 Highway
Homer City, PA 15748
Co-ed school, 1-9
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Breezy Lane School",'Homer_City=' + Homer_City.length); Clymer[Clymer.length] = createMarker(new GPoint(-78.98958700,40.69111200),"
Calvary Baptist Academy
11394 Route 286 Hwy E
Clymer, PA 15728
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Calvary Baptist Academy",'Clymer=' + Clymer.length); Penn_Run[Penn_Run.length] = createMarker(new GPoint(-78.97713000,40.61824300),"
Cedar Hollow School
3225 Laurel Run Road
Penn Run, PA 15765
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Cedar Hollow School",'Penn_Run=' + Penn_Run.length); Smicksburg[Smicksburg.length] = createMarker(new GPoint(-79.18875500,40.86504500),"
Dry Knob Amish School
245 Weasle Slide Drive
Smicksburg, PA 16256
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Dry Knob Amish School",'Smicksburg=' + Smicksburg.length); Shelocta[Shelocta.length] = createMarker(new GPoint(-79.32900000,40.65990000),"
Faith Baptist Church Academy
Po Box 213
Shelocta, PA 15774
Co-ed school, K-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Faith Baptist Church Academy",'Shelocta=' + Shelocta.length); Home[Home.length] = createMarker(new GPoint(-79.18966100,40.82692800),"
Hickory Hollow Amish School
4959 Mahoning Road
Home, PA 15747
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Hickory Hollow Amish School",'Home=' + Home.length); Dixonville[Dixonville.length] = createMarker(new GPoint(-79.00630000,40.71720000),"
Indiana Wesleyan School
Po Box 313
Dixonville, PA 15734
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Indiana Wesleyan School",'Dixonville=' + Dixonville.length); Indiana[Indiana.length] = createMarker(new GPoint(-79.15317300,40.62073700),"
Keys Montessori School
695 School Street
Indiana, PA 15701
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Keys Montessori School",'Indiana=' + Indiana.length); Punxsutawney[Punxsutawney.length] = createMarker(new GPoint(-79.04150000,40.89806500),"
Lone Maple Amish School

Punxsutawney, PA 15767
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Lone Maple Amish School",'Punxsutawney=' + Punxsutawney.length); Smicksburg[Smicksburg.length] = createMarker(new GPoint(-79.14220000,40.86440000),"
Oak Grove Parochial School
Co Dan Kiem, 245 Weasle Slide Dr
Smicksburg, PA 16256
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Oak Grove Parochial School",'Smicksburg=' + Smicksburg.length); Smicksburg[Smicksburg.length] = createMarker(new GPoint(-79.14220000,40.86440000),"
Owl Hollow Amish School
Co Dan Kiem, 245 Weasle Slide Dr
Smicksburg, PA 16256
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Owl Hollow Amish School",'Smicksburg=' + Smicksburg.length); Smicksburg[Smicksburg.length] = createMarker(new GPoint(-79.14220000,40.86440000),"
Pine Grove Amish School
Co Dan Kiem, 245 Weasle Slide Dr
Smicksburg, PA 16256
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Pine Grove Amish School",'Smicksburg=' + Smicksburg.length); Marion_Center[Marion_Center.length] = createMarker(new GPoint(-79.03090000,40.77000000),"
Pine Ridge Amish School
Rr 2
Marion Center, PA 15759
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Pine Ridge Amish School",'Marion_Center=' + Marion_Center.length); Home[Home.length] = createMarker(new GPoint(-79.13188100,40.80067300),"
Rose Valley School
595 Wise Rd
Home, PA 15747
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Rose Valley School",'Home=' + Home.length); Indiana[Indiana.length] = createMarker(new GPoint(-79.13426300,40.62907400),"
St. Bernard School
300 Clairvaux Drive
Indiana, PA 15701
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Bernard School",'Indiana=' + Indiana.length); Smicksburg[Smicksburg.length] = createMarker(new GPoint(-79.14220000,40.86440000),"
Shady Lane Amish School
Co Dan Kiem, 245 Weasle Slide Dr
Smicksburg, PA 16256
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Shady Lane Amish School",'Smicksburg=' + Smicksburg.length); Smicksburg[Smicksburg.length] = createMarker(new GPoint(-79.14220000,40.86440000),"
Shady Run Amish School
2854 Rte 954 Hwy N
Smicksburg, PA 16256
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Shady Run Amish School",'Smicksburg=' + Smicksburg.length); Smicksburg[Smicksburg.length] = createMarker(new GPoint(-79.14220000,40.86440000),"
Spring Hollow Amish School
Co Dan Kiem, 245 Weasle Slide Dr
Smicksburg, PA 16256
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Spring Hollow Amish School",'Smicksburg=' + Smicksburg.length); Rochester_Mills[Rochester_Mills.length] = createMarker(new GPoint(-78.88940000,40.78080000),"
Spring Run School
Rr 1 Box 152e
Rochester Mills, PA 15771
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Spring Run School",'Rochester_Mills=' + Rochester_Mills.length); Smicksburg[Smicksburg.length] = createMarker(new GPoint(-79.14220000,40.86440000),"
Stoney Acres School
Co Dan Kiem, 245 Weasle Slide Dr
Smicksburg, PA 16256
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Stoney Acres School",'Smicksburg=' + Smicksburg.length); Smicksburg[Smicksburg.length] = createMarker(new GPoint(-79.14220000,40.86440000),"
Stony Flat Amish School
Co Dan Kiem, 245 Weasle Slide Dr
Smicksburg, PA 16256
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Stony Flat Amish School",'Smicksburg=' + Smicksburg.length); Marion_Center[Marion_Center.length] = createMarker(new GPoint(-79.03090000,40.77000000),"
Walnut Hollow Amish School
Rr 2
Marion Center, PA 15759
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Walnut Hollow Amish School",'Marion_Center=' + Marion_Center.length); Smicksburg[Smicksburg.length] = createMarker(new GPoint(-79.14220000,40.86440000),"
Whippoorwill School
Co Dan Kiem, 245 Weasle Slide Dr
Smicksburg, PA 16256
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Whippoorwill School",'Smicksburg=' + Smicksburg.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(Aultman); map.removeOverlays(Clymer); map.removeOverlays(Dixonville); map.removeOverlays(Home); map.removeOverlays(Homer_City); map.removeOverlays(Indiana); map.removeOverlays(Kent); map.removeOverlays(Marion_Center); map.removeOverlays(Penn_Run); map.removeOverlays(Punxsutawney); map.removeOverlays(Rochester_Mills); map.removeOverlays(Shelocta); map.removeOverlays(Smicksburg); 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(Kent);map.removeOverlays(Aultman); map.removeOverlays(Clymer); map.removeOverlays(Dixonville); map.removeOverlays(Home); map.removeOverlays(Homer_City); map.removeOverlays(Indiana); map.removeOverlays(Kent); map.removeOverlays(Marion_Center); map.removeOverlays(Penn_Run); map.removeOverlays(Punxsutawney); map.removeOverlays(Rochester_Mills); map.removeOverlays(Shelocta); map.removeOverlays(Smicksburg); map.addOverlays(Aultman); centerByArray(Aultman, false, false); cntMarker += Aultman.length; map.addOverlays(Clymer); centerByArray(Clymer, false, false); cntMarker += Clymer.length; map.addOverlays(Dixonville); centerByArray(Dixonville, false, false); cntMarker += Dixonville.length; map.addOverlays(Home); centerByArray(Home, false, false); cntMarker += Home.length; map.addOverlays(Homer_City); centerByArray(Homer_City, false, false); cntMarker += Homer_City.length; map.addOverlays(Indiana); centerByArray(Indiana, false, false); cntMarker += Indiana.length; map.addOverlays(Kent); centerByArray(Kent, false, false); cntMarker += Kent.length; map.addOverlays(Marion_Center); centerByArray(Marion_Center, false, false); cntMarker += Marion_Center.length; map.addOverlays(Penn_Run); centerByArray(Penn_Run, false, false); cntMarker += Penn_Run.length; map.addOverlays(Punxsutawney); centerByArray(Punxsutawney, false, false); cntMarker += Punxsutawney.length; map.addOverlays(Rochester_Mills); centerByArray(Rochester_Mills, false, false); cntMarker += Rochester_Mills.length; map.addOverlays(Shelocta); centerByArray(Shelocta, false, false); cntMarker += Shelocta.length; map.addOverlays(Smicksburg); centerByArray(Smicksburg, false, false); cntMarker += Smicksburg.length; centerByArray(Kent,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; }