function addMarkers() { mySelect = document.getElementById('selection'); Berlin = [];Cairnbrook = [];Johnstown = [];Davidsville = [];Jerome = [];Somerset = [];Friedens = [];Markleton = [];Meyersdale = [];Boswell = [];Stoystown = [];Jennerstown = [];Rockwood = [];Salisbury = [];Shanksville = [];Sipesville = [];Confluence = [];Windber = [];mySelect.options[mySelect.options.length] = new Option("Berlin schools",'all=Berlin'); mySelect.options[mySelect.options.length] = new Option("Boswell schools",'all=Boswell'); mySelect.options[mySelect.options.length] = new Option("Cairnbrook schools",'all=Cairnbrook'); mySelect.options[mySelect.options.length] = new Option("Confluence schools",'all=Confluence'); mySelect.options[mySelect.options.length] = new Option("Davidsville schools",'all=Davidsville'); mySelect.options[mySelect.options.length] = new Option("Friedens schools",'all=Friedens'); mySelect.options[mySelect.options.length] = new Option("Jennerstown schools",'all=Jennerstown'); mySelect.options[mySelect.options.length] = new Option("Jerome schools",'all=Jerome'); mySelect.options[mySelect.options.length] = new Option("Johnstown schools",'all=Johnstown'); mySelect.options[mySelect.options.length] = new Option("Markleton schools",'all=Markleton'); mySelect.options[mySelect.options.length] = new Option("Meyersdale schools",'all=Meyersdale'); mySelect.options[mySelect.options.length] = new Option("Rockwood schools",'all=Rockwood'); mySelect.options[mySelect.options.length] = new Option("Salisbury schools",'all=Salisbury'); mySelect.options[mySelect.options.length] = new Option("Shanksville schools",'all=Shanksville'); mySelect.options[mySelect.options.length] = new Option("Sipesville schools",'all=Sipesville'); mySelect.options[mySelect.options.length] = new Option("Somerset schools",'all=Somerset'); mySelect.options[mySelect.options.length] = new Option("Stoystown schools",'all=Stoystown'); mySelect.options[mySelect.options.length] = new Option("Windber schools",'all=Windber'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Berlin[Berlin.length] = createMarker(new GPoint(-78.94734955,39.92123795),"
Berlin Brothersvalley Elementary School
1025 E Main Street
Berlin, PA 15530

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Berlin Brothersvalley Elementary School",'Berlin=' + Berlin.length); Berlin[Berlin.length] = createMarker(new GPoint(-78.94734955,39.92123795),"
Berlin Brothersvalley Middle School
1025 E Main Street
Berlin, PA 15530

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Berlin Brothersvalley Middle School",'Berlin=' + Berlin.length); Berlin[Berlin.length] = createMarker(new GPoint(-78.94734955,39.92123795),"
Berlin Brothersvalley Senior High School
1025 E Main Street
Berlin, PA 15530

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Berlin Brothersvalley Senior High School",'Berlin=' + Berlin.length); Cairnbrook[Cairnbrook.length] = createMarker(new GPoint(-78.82499695,40.12939835),"
Cairnbrook Elementary School
235 Mcgregor Ave
Cairnbrook, PA 15924

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Cairnbrook Elementary School",'Cairnbrook=' + Cairnbrook.length); Johnstown[Johnstown.length] = createMarker(new GPoint(-78.92111969,40.24246979),"
Conemaugh Township Area Intrmd School
1516 Tire Hill Rd
Johnstown, PA 15905

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Conemaugh Township Area Intrmd School",'Johnstown=' + Johnstown.length); Davidsville[Davidsville.length] = createMarker(new GPoint(-78.92250061,40.23770142),"
Conemaugh Township Area Junior Senior High School
Po Box 407
Davidsville, PA 15928

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Conemaugh Township Area Junior Senior High School",'Davidsville=' + Davidsville.length); Jerome[Jerome.length] = createMarker(new GPoint(-78.98930359,40.20819855),"
Conemaugh Township Area Primary School
Po Box 396
Jerome, PA 15937

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Conemaugh Township Area Primary School",'Jerome=' + Jerome.length); Somerset[Somerset.length] = createMarker(new GPoint(-79.10337830,40.00950241),"
Eagle View Elementary School
191 Discovery Ln
Somerset, PA 15501

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Eagle View Elementary School",'Somerset=' + Somerset.length); Friedens[Friedens.length] = createMarker(new GPoint(-79.00682831,40.04551315),"
Friedens Elementary School
1936 Stoystown Rd
Friedens, PA 15541

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Friedens Elementary School",'Friedens=' + Friedens.length); Markleton[Markleton.length] = createMarker(new GPoint(-79.26429749,39.88190079),"
Kingwood Elementary School
5957 Kingwood Rd
Markleton, PA 15551

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Kingwood Elementary School",'Markleton=' + Markleton.length); Somerset[Somerset.length] = createMarker(new GPoint(-79.09978485,40.00469208),"
Maple Ridge Elementary School
105 New Centerville Rd
Somerset, PA 15501

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Maple Ridge Elementary School",'Somerset=' + Somerset.length); Meyersdale[Meyersdale.length] = createMarker(new GPoint(-79.04502106,39.79724884),"
Meyersdale Area Elementary School
1345 Shaw Mines Rd
Meyersdale, PA 15552

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Meyersdale Area Elementary School",'Meyersdale=' + Meyersdale.length); Meyersdale[Meyersdale.length] = createMarker(new GPoint(-79.04483795,39.79715347),"
Meyersdale Area High School
1349 Shaw Mines Rd
Meyersdale, PA 15552

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Meyersdale Area High School",'Meyersdale=' + Meyersdale.length); Meyersdale[Meyersdale.length] = createMarker(new GPoint(-79.04465485,39.79705811),"
Meyersdale Area Middle School
1353 Shaw Mines Rd
Meyersdale, PA 15552

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Meyersdale Area Middle School",'Meyersdale=' + Meyersdale.length); Boswell[Boswell.length] = createMarker(new GPoint(-79.03444672,40.15802383),"
North Star Central Elementary School
1215 Morris Ave
Boswell, PA 15531

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("North Star Central Elementary School",'Boswell=' + Boswell.length); Stoystown[Stoystown.length] = createMarker(new GPoint(-78.93473053,40.10306168),"
North Star East Elementary School
3598 Whistler Road
Stoystown, PA 15563

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("North Star East Elementary School",'Stoystown=' + Stoystown.length); Stoystown[Stoystown.length] = createMarker(new GPoint(-78.93473053,40.10306168),"
North Star East Middle School
3598 Whistler Rd
Stoystown, PA 15563

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("North Star East Middle School",'Stoystown=' + Stoystown.length); Boswell[Boswell.length] = createMarker(new GPoint(-79.03014374,40.15939331),"
North Star High School
400 Ohio St
Boswell, PA 15531

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("North Star High School",'Boswell=' + Boswell.length); Jennerstown[Jennerstown.length] = createMarker(new GPoint(-79.06659698,40.15969849),"
North Star West Elementary School
Po Box 189
Jennerstown, PA 15547

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("North Star West Elementary School",'Jennerstown=' + Jennerstown.length); Rockwood[Rockwood.length] = createMarker(new GPoint(-79.16063690,39.91708755),"
Rockwood Area Elementary School
435 Somerset Ave
Rockwood, PA 15557

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Rockwood Area Elementary School",'Rockwood=' + Rockwood.length); Rockwood[Rockwood.length] = createMarker(new GPoint(-79.16060638,39.91709900),"
Rockwood Area Junior Senior High School
437 Somerset Ave
Rockwood, PA 15557

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Rockwood Area Junior Senior High School",'Rockwood=' + Rockwood.length); Salisbury[Salisbury.length] = createMarker(new GPoint(-79.08354950,39.75178146),"
Salisbury-elk Lick Elementary School
196 Smith Ave Po Box 68
Salisbury, PA 15558

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Salisbury-elk Lick Elementary School",'Salisbury=' + Salisbury.length); Salisbury[Salisbury.length] = createMarker(new GPoint(-79.08357239,39.75169754),"
Salisbury-elk Lick Junior Senior High School
200 Smith Ave Po Box 68
Salisbury, PA 15558

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Salisbury-elk Lick Junior Senior High School",'Salisbury=' + Salisbury.length); Cairnbrook[Cairnbrook.length] = createMarker(new GPoint(-78.82499695,40.12939835),"
Shade Junior Senior High School
203 Mcgregor Ave
Cairnbrook, PA 15924

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Shade Junior Senior High School",'Cairnbrook=' + Cairnbrook.length); Shanksville[Shanksville.length] = createMarker(new GPoint(-78.90570068,40.01679993),"
Shanksville-stonycreek Elementary School
Po Box 128
Shanksville, PA 15560

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Shanksville-stonycreek Elementary School",'Shanksville=' + Shanksville.length); Shanksville[Shanksville.length] = createMarker(new GPoint(-78.90570068,40.01679993),"
Shanksville-stonycreek High School
Po Box 128
Shanksville, PA 15560

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Shanksville-stonycreek High School",'Shanksville=' + Shanksville.length); Shanksville[Shanksville.length] = createMarker(new GPoint(-78.90570068,40.01679993),"
Shanksville-stonycreek Middle School
Po Box 128
Shanksville, PA 15560

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Shanksville-stonycreek Middle School",'Shanksville=' + Shanksville.length); Sipesville[Sipesville.length] = createMarker(new GPoint(-79.09011078,40.09830475),"
Sipesville Elementary School
1036 Schoolhouse Road
Sipesville, PA 15561

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Sipesville Elementary School",'Sipesville=' + Sipesville.length); Somerset[Somerset.length] = createMarker(new GPoint(-79.08632660,40.00186157),"
Somerset Area Junior High School
645 S Columbia Ave Ste 120
Somerset, PA 15501

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Somerset Area Junior High School",'Somerset=' + Somerset.length); Somerset[Somerset.length] = createMarker(new GPoint(-79.08632660,40.00186157),"
Somerset Area Senior High School
645 S Columbia Ave Ste 130
Somerset, PA 15501

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Somerset Area Senior High School",'Somerset=' + Somerset.length); Somerset[Somerset.length] = createMarker(new GPoint(-79.03323364,40.00286865),"
Somerset County Technology Cen
281 Technology Drive
Somerset, PA 15501

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Somerset County Technology Cen",'Somerset=' + Somerset.length); Confluence[Confluence.length] = createMarker(new GPoint(-79.32899475,39.79904938),"
Turkeyfoot Valley Area Elementary School
172 Turkeyfoot Rd
Confluence, PA 15424

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Turkeyfoot Valley Area Elementary School",'Confluence=' + Confluence.length); Confluence[Confluence.length] = createMarker(new GPoint(-79.32899475,39.79904938),"
Turkeyfoot Valley Area Junior Senior High School
172 Turkeyfoot Rd
Confluence, PA 15424

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Turkeyfoot Valley Area Junior Senior High School",'Confluence=' + Confluence.length); Windber[Windber.length] = createMarker(new GPoint(-78.82467651,40.23078537),"
Windber Area High School
2301 Graham Ave
Windber, PA 15963

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Windber Area High School",'Windber=' + Windber.length); Windber[Windber.length] = createMarker(new GPoint(-78.82467651,40.23078537),"
Windber Area Middle School
2301 Graham Ave
Windber, PA 15963

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Windber Area Middle School",'Windber=' + Windber.length); Windber[Windber.length] = createMarker(new GPoint(-78.81007385,40.21746063),"
Windber Elementary School
421 Sugar Maple Dr
Windber, PA 15963

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Windber Elementary School",'Windber=' + Windber.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(Berlin); map.removeOverlays(Boswell); map.removeOverlays(Cairnbrook); map.removeOverlays(Confluence); map.removeOverlays(Davidsville); map.removeOverlays(Friedens); map.removeOverlays(Jennerstown); map.removeOverlays(Jerome); map.removeOverlays(Johnstown); map.removeOverlays(Markleton); map.removeOverlays(Meyersdale); map.removeOverlays(Rockwood); map.removeOverlays(Salisbury); map.removeOverlays(Shanksville); map.removeOverlays(Sipesville); map.removeOverlays(Somerset); map.removeOverlays(Stoystown); map.removeOverlays(Windber); 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(Berlin);map.removeOverlays(Berlin); map.removeOverlays(Boswell); map.removeOverlays(Cairnbrook); map.removeOverlays(Confluence); map.removeOverlays(Davidsville); map.removeOverlays(Friedens); map.removeOverlays(Jennerstown); map.removeOverlays(Jerome); map.removeOverlays(Johnstown); map.removeOverlays(Markleton); map.removeOverlays(Meyersdale); map.removeOverlays(Rockwood); map.removeOverlays(Salisbury); map.removeOverlays(Shanksville); map.removeOverlays(Sipesville); map.removeOverlays(Somerset); map.removeOverlays(Stoystown); map.removeOverlays(Windber); map.addOverlays(Berlin); centerByArray(Berlin, false, false); cntMarker += Berlin.length; map.addOverlays(Boswell); centerByArray(Boswell, false, false); cntMarker += Boswell.length; map.addOverlays(Cairnbrook); centerByArray(Cairnbrook, false, false); cntMarker += Cairnbrook.length; map.addOverlays(Confluence); centerByArray(Confluence, false, false); cntMarker += Confluence.length; map.addOverlays(Davidsville); centerByArray(Davidsville, false, false); cntMarker += Davidsville.length; map.addOverlays(Friedens); centerByArray(Friedens, false, false); cntMarker += Friedens.length; map.addOverlays(Jennerstown); centerByArray(Jennerstown, false, false); cntMarker += Jennerstown.length; map.addOverlays(Jerome); centerByArray(Jerome, false, false); cntMarker += Jerome.length; map.addOverlays(Johnstown); centerByArray(Johnstown, false, false); cntMarker += Johnstown.length; map.addOverlays(Markleton); centerByArray(Markleton, false, false); cntMarker += Markleton.length; map.addOverlays(Meyersdale); centerByArray(Meyersdale, false, false); cntMarker += Meyersdale.length; map.addOverlays(Rockwood); centerByArray(Rockwood, false, false); cntMarker += Rockwood.length; map.addOverlays(Salisbury); centerByArray(Salisbury, false, false); cntMarker += Salisbury.length; map.addOverlays(Shanksville); centerByArray(Shanksville, false, false); cntMarker += Shanksville.length; map.addOverlays(Sipesville); centerByArray(Sipesville, false, false); cntMarker += Sipesville.length; map.addOverlays(Somerset); centerByArray(Somerset, false, false); cntMarker += Somerset.length; map.addOverlays(Stoystown); centerByArray(Stoystown, false, false); cntMarker += Stoystown.length; map.addOverlays(Windber); centerByArray(Windber, false, false); cntMarker += Windber.length; centerByArray(Berlin,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'); } }