function addMarkers() { mySelect = document.getElementById('selection'); Bigler = [];Clearfield = [];Curwensville = [];Du_Bois = [];Frenchville = [];Westover = [];Luthersburg = [];Houtzdale = [];Philipsburg = [];Osceola_Mills = [];Penfield = [];Grampian = [];Mahaffey = [];Wallaceton = [];Morrisdale = [];mySelect.options[mySelect.options.length] = new Option("Bigler schools",'all=Bigler'); mySelect.options[mySelect.options.length] = new Option("Clearfield schools",'all=Clearfield'); mySelect.options[mySelect.options.length] = new Option("Curwensville schools",'all=Curwensville'); mySelect.options[mySelect.options.length] = new Option("Du Bois schools",'all=Du_Bois'); mySelect.options[mySelect.options.length] = new Option("Frenchville schools",'all=Frenchville'); mySelect.options[mySelect.options.length] = new Option("Grampian schools",'all=Grampian'); mySelect.options[mySelect.options.length] = new Option("Houtzdale schools",'all=Houtzdale'); mySelect.options[mySelect.options.length] = new Option("Luthersburg schools",'all=Luthersburg'); mySelect.options[mySelect.options.length] = new Option("Mahaffey schools",'all=Mahaffey'); mySelect.options[mySelect.options.length] = new Option("Morrisdale schools",'all=Morrisdale'); mySelect.options[mySelect.options.length] = new Option("Osceola Mills schools",'all=Osceola_Mills'); mySelect.options[mySelect.options.length] = new Option("Penfield schools",'all=Penfield'); mySelect.options[mySelect.options.length] = new Option("Philipsburg schools",'all=Philipsburg'); mySelect.options[mySelect.options.length] = new Option("Wallaceton schools",'all=Wallaceton'); mySelect.options[mySelect.options.length] = new Option("Westover schools",'all=Westover'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Bigler[Bigler.length] = createMarker(new GPoint(-78.43869781,41.02809906),"
Bradford Township Elementary School
50 Bigler Rd
Bigler, PA 16825

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Bradford Township Elementary School",'Bigler=' + Bigler.length); Clearfield[Clearfield.length] = createMarker(new GPoint(-78.43869781,41.02809906),"
Centre Elementary School
Po Box 710
Clearfield, PA 16830

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Centre Elementary School",'Clearfield=' + Clearfield.length); Clearfield[Clearfield.length] = createMarker(new GPoint(-78.43869781,41.02809906),"
Clearfield Area High School
Po Box 910
Clearfield, PA 16830

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Clearfield Area High School",'Clearfield=' + Clearfield.length); Clearfield[Clearfield.length] = createMarker(new GPoint(-78.43869781,41.02809906),"
Clearfield Area Middle School
Po Box 710
Clearfield, PA 16830

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Clearfield Area Middle School",'Clearfield=' + Clearfield.length); Clearfield[Clearfield.length] = createMarker(new GPoint(-78.42823792,41.03327942),"
Clearfield County Ctc
1620 River Rd
Clearfield, PA 16830

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Clearfield County Ctc",'Clearfield=' + Clearfield.length); Clearfield[Clearfield.length] = createMarker(new GPoint(-78.43821716,41.03623962),"
Clearfield Elementary School
700 High Level Rd
Clearfield, PA 16830

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Clearfield Elementary School",'Clearfield=' + Clearfield.length); Curwensville[Curwensville.length] = createMarker(new GPoint(-78.52095795,40.96823120),"
Curwensville Area Elementary School
650 Beech St
Curwensville, PA 16833

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Curwensville Area Elementary School",'Curwensville=' + Curwensville.length); Curwensville[Curwensville.length] = createMarker(new GPoint(-78.52095795,40.96823120),"
Curwensville Area Junior Senior High School
650 Beech St
Curwensville, PA 16833

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Curwensville Area Junior Senior High School",'Curwensville=' + Curwensville.length); Du_Bois[Du_Bois.length] = createMarker(new GPoint(-78.75831604,41.12171555),"
Dubois Area Middle School
404 Liberty Blvd
Du Bois, PA 15801

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Dubois Area Middle School",'Du_Bois=' + Du_Bois.length); Du_Bois[Du_Bois.length] = createMarker(new GPoint(-78.74485779,41.12606430),"
Dubois Area Senior High School
425 Orient Ave
Du Bois, PA 15801

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Dubois Area Senior High School",'Du_Bois=' + Du_Bois.length); Clearfield[Clearfield.length] = createMarker(new GPoint(-78.43869781,41.02809906),"
Girard Elementary School
Po Box 710
Clearfield, PA 16830

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Girard Elementary School",'Clearfield=' + Clearfield.length); Frenchville[Frenchville.length] = createMarker(new GPoint(-78.28337860,41.08316040),"
Girard-goshen Elementary School
8962 Gillingham Road
Frenchville, PA 16836

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Girard-goshen Elementary School",'Frenchville=' + Frenchville.length); Clearfield[Clearfield.length] = createMarker(new GPoint(-78.43869781,41.02809906),"
Goshen Elementary School
Po Box 710
Clearfield, PA 16830

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Goshen Elementary School",'Clearfield=' + Clearfield.length); Westover[Westover.length] = createMarker(new GPoint(-78.73300171,40.77190018),"
Harmony Area Elementary School
5239 Ridge Rd
Westover, PA 16692

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Harmony Area Elementary School",'Westover=' + Westover.length); Westover[Westover.length] = createMarker(new GPoint(-78.73300171,40.77190018),"
Harmony Area High School
5239 Ridge Rd
Westover, PA 16692

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Harmony Area High School",'Westover=' + Westover.length); Westover[Westover.length] = createMarker(new GPoint(-78.67800400,40.74375000),"
Harmony Area MiddleSchool
5239 Ridge Rd
Westover, PA 16692

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Harmony Area MiddleSchool",'Westover=' + Westover.length); Du_Bois[Du_Bois.length] = createMarker(new GPoint(-78.73310089,41.10210037),"
Highland Street Elementary School
Rd 2 Box 525
Du Bois, PA 15801

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Highland Street Elementary School",'Du_Bois=' + Du_Bois.length); Du_Bois[Du_Bois.length] = createMarker(new GPoint(-78.75942993,41.12994766),"
Juniata Elementary School
248 Juniata Street
Du Bois, PA 15801

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Juniata Elementary School",'Du_Bois=' + Du_Bois.length); Luthersburg[Luthersburg.length] = createMarker(new GPoint(-78.71923065,41.05329895),"
Luthersburg Elementary School
2672 Helvetia Rd
Luthersburg, PA 15848

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Luthersburg Elementary School",'Luthersburg=' + Luthersburg.length); Houtzdale[Houtzdale.length] = createMarker(new GPoint(-78.38449860,40.82830048),"
Moshannon Valley Elementary School
5026 Green Acre Rd
Houtzdale, PA 16651

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Moshannon Valley Elementary School",'Houtzdale=' + Houtzdale.length); Houtzdale[Houtzdale.length] = createMarker(new GPoint(-78.38449860,40.82830048),"
Moshannon Valley Junior Senior High School
4934 Green Acre Rd
Houtzdale, PA 16651

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Moshannon Valley Junior Senior High School",'Houtzdale=' + Houtzdale.length); Philipsburg[Philipsburg.length] = createMarker(new GPoint(-78.23574829,40.88776398),"
North Lincoln Hill Elementary School
200 Short St
Philipsburg, PA 16866

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("North Lincoln Hill Elementary School",'Philipsburg=' + Philipsburg.length); Du_Bois[Du_Bois.length] = createMarker(new GPoint(-78.75335693,41.13037872),"
Oklahoma Elementary School
Rd 3 Chestnut Ave
Du Bois, PA 15801

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Oklahoma Elementary School",'Du_Bois=' + Du_Bois.length); Osceola_Mills[Osceola_Mills.length] = createMarker(new GPoint(-78.27332306,40.85203934),"
Osceola Mills Elementary School
400 Coal St
Osceola Mills, PA 16666

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Osceola Mills Elementary School",'Osceola_Mills=' + Osceola_Mills.length); Penfield[Penfield.length] = createMarker(new GPoint(-78.56839752,41.20909882),"
Penfield Elementary School
201 Hoovertown Rd
Penfield, PA 15849

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Penfield Elementary School",'Penfield=' + Penfield.length); Grampian[Grampian.length] = createMarker(new GPoint(-78.61849976,40.96760178),"
Penn-grampian Elementary School
178 Walltown Rd
Grampian, PA 16838

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Penn-grampian Elementary School",'Grampian=' + Grampian.length); Philipsburg[Philipsburg.length] = createMarker(new GPoint(-78.21575165,40.89979172),"
Philipsburg Elementary School
1810 Black Moshannon Road
Philipsburg, PA 16866

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Philipsburg Elementary School",'Philipsburg=' + Philipsburg.length); Mahaffey[Mahaffey.length] = createMarker(new GPoint(-78.79868317,40.86701965),"
Purchase Line North Elementary School
5995 Fire Tower Rd
Mahaffey, PA 15757

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Purchase Line North Elementary School",'Mahaffey=' + Mahaffey.length); Wallaceton[Wallaceton.length] = createMarker(new GPoint(-78.28678131,40.95806122),"
Wallaceton-boggs Elementary School
264 Wilson St
Wallaceton, PA 16876

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Wallaceton-boggs Elementary School",'Wallaceton=' + Wallaceton.length); Du_Bois[Du_Bois.length] = createMarker(new GPoint(-78.77426910,41.10765457),"
Wasson Avenue Elementary School
300 Wasson Ave
Du Bois, PA 15801

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Wasson Avenue Elementary School",'Du_Bois=' + Du_Bois.length); Morrisdale[Morrisdale.length] = createMarker(new GPoint(-78.20480347,40.98120117),"
West Branch Area Elementary School
356 Allport Cutoff
Morrisdale, PA 16858

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("West Branch Area Elementary School",'Morrisdale=' + Morrisdale.length); Morrisdale[Morrisdale.length] = createMarker(new GPoint(-78.20480347,40.98120117),"
West Branch Area Junior Senior High School
356 Allport Cutoff
Morrisdale, PA 16858

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("West Branch Area Junior Senior High School",'Morrisdale=' + Morrisdale.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(Bigler); map.removeOverlays(Clearfield); map.removeOverlays(Curwensville); map.removeOverlays(Du_Bois); map.removeOverlays(Frenchville); map.removeOverlays(Grampian); map.removeOverlays(Houtzdale); map.removeOverlays(Luthersburg); map.removeOverlays(Mahaffey); map.removeOverlays(Morrisdale); map.removeOverlays(Osceola_Mills); map.removeOverlays(Penfield); map.removeOverlays(Philipsburg); map.removeOverlays(Wallaceton); map.removeOverlays(Westover); 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(Bigler);map.removeOverlays(Bigler); map.removeOverlays(Clearfield); map.removeOverlays(Curwensville); map.removeOverlays(Du_Bois); map.removeOverlays(Frenchville); map.removeOverlays(Grampian); map.removeOverlays(Houtzdale); map.removeOverlays(Luthersburg); map.removeOverlays(Mahaffey); map.removeOverlays(Morrisdale); map.removeOverlays(Osceola_Mills); map.removeOverlays(Penfield); map.removeOverlays(Philipsburg); map.removeOverlays(Wallaceton); map.removeOverlays(Westover); map.addOverlays(Bigler); centerByArray(Bigler, false, false); cntMarker += Bigler.length; map.addOverlays(Clearfield); centerByArray(Clearfield, false, false); cntMarker += Clearfield.length; map.addOverlays(Curwensville); centerByArray(Curwensville, false, false); cntMarker += Curwensville.length; map.addOverlays(Du_Bois); centerByArray(Du_Bois, false, false); cntMarker += Du_Bois.length; map.addOverlays(Frenchville); centerByArray(Frenchville, false, false); cntMarker += Frenchville.length; map.addOverlays(Grampian); centerByArray(Grampian, false, false); cntMarker += Grampian.length; map.addOverlays(Houtzdale); centerByArray(Houtzdale, false, false); cntMarker += Houtzdale.length; map.addOverlays(Luthersburg); centerByArray(Luthersburg, false, false); cntMarker += Luthersburg.length; map.addOverlays(Mahaffey); centerByArray(Mahaffey, false, false); cntMarker += Mahaffey.length; map.addOverlays(Morrisdale); centerByArray(Morrisdale, false, false); cntMarker += Morrisdale.length; map.addOverlays(Osceola_Mills); centerByArray(Osceola_Mills, false, false); cntMarker += Osceola_Mills.length; map.addOverlays(Penfield); centerByArray(Penfield, false, false); cntMarker += Penfield.length; map.addOverlays(Philipsburg); centerByArray(Philipsburg, false, false); cntMarker += Philipsburg.length; map.addOverlays(Wallaceton); centerByArray(Wallaceton, false, false); cntMarker += Wallaceton.length; map.addOverlays(Westover); centerByArray(Westover, false, false); cntMarker += Westover.length; centerByArray(Bigler,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'); } }