function addMarkers() { mySelect = document.getElementById('selection'); Aliquippa = [];Ambridge = [];Freedom = [];Beaver = [];Monaca = [];Beaver_Falls = [];Conway = [];Midland = [];Koppel = [];New_Brighton = [];Darlington = [];Ellwood_City = [];Rochester = [];Industry = [];Hookstown = [];Baden = [];mySelect.options[mySelect.options.length] = new Option("Aliquippa schools",'all=Aliquippa'); mySelect.options[mySelect.options.length] = new Option("Ambridge schools",'all=Ambridge'); mySelect.options[mySelect.options.length] = new Option("Baden schools",'all=Baden'); mySelect.options[mySelect.options.length] = new Option("Beaver schools",'all=Beaver'); mySelect.options[mySelect.options.length] = new Option("Beaver Falls schools",'all=Beaver_Falls'); mySelect.options[mySelect.options.length] = new Option("Conway schools",'all=Conway'); mySelect.options[mySelect.options.length] = new Option("Darlington schools",'all=Darlington'); mySelect.options[mySelect.options.length] = new Option("Ellwood City schools",'all=Ellwood_City'); mySelect.options[mySelect.options.length] = new Option("Freedom schools",'all=Freedom'); mySelect.options[mySelect.options.length] = new Option("Hookstown schools",'all=Hookstown'); mySelect.options[mySelect.options.length] = new Option("Industry schools",'all=Industry'); mySelect.options[mySelect.options.length] = new Option("Koppel schools",'all=Koppel'); mySelect.options[mySelect.options.length] = new Option("Midland schools",'all=Midland'); mySelect.options[mySelect.options.length] = new Option("Monaca schools",'all=Monaca'); mySelect.options[mySelect.options.length] = new Option("New Brighton schools",'all=New_Brighton'); mySelect.options[mySelect.options.length] = new Option("Rochester schools",'all=Rochester'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Aliquippa[Aliquippa.length] = createMarker(new GPoint(-80.27886963,40.60891342),"
",iconRd); mySelect.options[mySelect.options.length] = new Option("Aliquippa Elementary School",'Aliquippa=' + Aliquippa.length); Aliquippa[Aliquippa.length] = createMarker(new GPoint(-80.25672150,40.60913849),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Aliquippa Middle School",'Aliquippa=' + Aliquippa.length); Aliquippa[Aliquippa.length] = createMarker(new GPoint(-80.25694600,40.60912500),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Aliquippa MiddleSchool",'Aliquippa=' + Aliquippa.length); Aliquippa[Aliquippa.length] = createMarker(new GPoint(-80.25672150,40.60913849),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Aliquippa Senior High School",'Aliquippa=' + Aliquippa.length); Ambridge[Ambridge.length] = createMarker(new GPoint(-80.22544861,40.59139633),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Ambridge Area High School",'Ambridge=' + Ambridge.length); Freedom[Freedom.length] = createMarker(new GPoint(-80.21219635,40.66777039),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Ambridge Area Junior High School",'Freedom=' + Freedom.length); Ambridge[Ambridge.length] = createMarker(new GPoint(-80.22518158,40.60214615),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Anthony Wayne Elementary School",'Ambridge=' + Ambridge.length); Beaver[Beaver.length] = createMarker(new GPoint(-80.33657600,40.70738900),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Beaver Area Academic Charter School",'Beaver=' + Beaver.length); Beaver[Beaver.length] = createMarker(new GPoint(-80.31759644,40.69760132),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Beaver Area Middle School",'Beaver=' + Beaver.length); Beaver[Beaver.length] = createMarker(new GPoint(-80.31759644,40.69760132),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Beaver Area Senior High School",'Beaver=' + Beaver.length); Monaca[Monaca.length] = createMarker(new GPoint(-80.30838013,40.65497589),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Beaver County Avts",'Monaca=' + Monaca.length); Beaver_Falls[Beaver_Falls.length] = createMarker(new GPoint(-80.32097626,40.75814056),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Beaver Falls Area Senior High School",'Beaver_Falls=' + Beaver_Falls.length); Beaver_Falls[Beaver_Falls.length] = createMarker(new GPoint(-80.32097626,40.75714493),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Beaver Falls Middle School",'Beaver_Falls=' + Beaver_Falls.length); Beaver_Falls[Beaver_Falls.length] = createMarker(new GPoint(-80.34194183,40.80937958),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Big Beaver Elementary School",'Beaver_Falls=' + Beaver_Falls.length); Freedom[Freedom.length] = createMarker(new GPoint(-80.20620728,40.70153046),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Big Knob Elementary School",'Freedom=' + Freedom.length); Beaver_Falls[Beaver_Falls.length] = createMarker(new GPoint(-80.39857483,40.76427460),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Blackhawk High School",'Beaver_Falls=' + Beaver_Falls.length); Beaver_Falls[Beaver_Falls.length] = createMarker(new GPoint(-80.37557220,40.76886749),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Blackhawk Intermediate School",'Beaver_Falls=' + Beaver_Falls.length); Beaver[Beaver.length] = createMarker(new GPoint(-80.40325165,40.70579147),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Brighton Township Elementary School",'Beaver=' + Beaver.length); Monaca[Monaca.length] = createMarker(new GPoint(-80.29930115,40.66540146),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Center Area Middle School",'Monaca=' + Monaca.length); Monaca[Monaca.length] = createMarker(new GPoint(-80.29930115,40.66540146),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Center Area Senior High School",'Monaca=' + Monaca.length); Beaver_Falls[Beaver_Falls.length] = createMarker(new GPoint(-80.32099400,40.75599500),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Central Elementary School",'Beaver_Falls=' + Beaver_Falls.length); Beaver[Beaver.length] = createMarker(new GPoint(-80.30556488,40.69669724),"",iconRd); mySelect.options[mySelect.options.length] = new Option("College Square Elementary School",'Beaver=' + Beaver.length); Conway[Conway.length] = createMarker(new GPoint(-80.23725891,40.65740204),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Conway Elementary School",'Conway=' + Conway.length); Freedom[Freedom.length] = createMarker(new GPoint(-80.21206665,40.66702271),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Economy Elementary School",'Freedom=' + Freedom.length); Midland[Midland.length] = createMarker(new GPoint(-80.47000122,40.69232178),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Fairview Elementary School",'Midland=' + Midland.length); Monaca[Monaca.length] = createMarker(new GPoint(-80.26470184,40.67573547),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Fifth Ward Elementary School",'Monaca=' + Monaca.length); Freedom[Freedom.length] = createMarker(new GPoint(-80.25173187,40.68558121),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Freedom Area Middle School",'Freedom=' + Freedom.length); Freedom[Freedom.length] = createMarker(new GPoint(-80.24055481,40.67859650),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Freedom Area Senior High School",'Freedom=' + Freedom.length); Monaca[Monaca.length] = createMarker(new GPoint(-80.27703857,40.68104935),"",iconRd); mySelect.options[mySelect.options.length] = new Option("High School Elementary School",'Monaca=' + Monaca.length); Ambridge[Ambridge.length] = createMarker(new GPoint(-80.21316528,40.59262466),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Highland Elementary School",'Ambridge=' + Ambridge.length); Beaver_Falls[Beaver_Falls.length] = createMarker(new GPoint(-80.37409973,40.75740814),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Highland Middle School",'Beaver_Falls=' + Beaver_Falls.length); Aliquippa[Aliquippa.length] = createMarker(new GPoint(-80.27954865,40.57771683),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Hopewell Elementary School",'Aliquippa=' + Aliquippa.length); Aliquippa[Aliquippa.length] = createMarker(new GPoint(-80.26261902,40.58964539),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Hopewell Junior High School",'Aliquippa=' + Aliquippa.length); Aliquippa[Aliquippa.length] = createMarker(new GPoint(-80.25433350,40.58916855),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Hopewell Senior High School",'Aliquippa=' + Aliquippa.length); Aliquippa[Aliquippa.length] = createMarker(new GPoint(-80.28399658,40.60409927),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Independence Elementary School",'Aliquippa=' + Aliquippa.length); Koppel[Koppel.length] = createMarker(new GPoint(-80.32592010,40.83555984),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Koppel Elementary School",'Koppel=' + Koppel.length); Monaca[Monaca.length] = createMarker(new GPoint(-80.27922058,40.69288635),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Mangin Elementary School",'Monaca=' + Monaca.length); Aliquippa[Aliquippa.length] = createMarker(new GPoint(-80.26049042,40.59276962),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Margaret Ross Elementary School",'Aliquippa=' + Aliquippa.length); Midland[Midland.length] = createMarker(new GPoint(-80.45157623,40.64013672),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Midland El/ms Elementary School",'Midland=' + Midland.length); Monaca[Monaca.length] = createMarker(new GPoint(-80.27703857,40.68104935),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Monaca Junior Senior High School",'Monaca=' + Monaca.length); New_Brighton[New_Brighton.length] = createMarker(new GPoint(-80.30264282,40.73351288),"",iconRd); mySelect.options[mySelect.options.length] = new Option("New Brighton Area Elementary School",'New_Brighton=' + New_Brighton.length); New_Brighton[New_Brighton.length] = createMarker(new GPoint(-80.30264282,40.73351288),"",iconGr); mySelect.options[mySelect.options.length] = new Option("New Brighton Area High School",'New_Brighton=' + New_Brighton.length); New_Brighton[New_Brighton.length] = createMarker(new GPoint(-80.30668640,40.73628998),"",iconBl); mySelect.options[mySelect.options.length] = new Option("New Brighton Area Middle School",'New_Brighton=' + New_Brighton.length); Darlington[Darlington.length] = createMarker(new GPoint(-80.41869354,40.81072235),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Northwestern Primary School",'Darlington=' + Darlington.length); Beaver_Falls[Beaver_Falls.length] = createMarker(new GPoint(-80.33452606,40.74799347),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Patterson Primary School",'Beaver_Falls=' + Beaver_Falls.length); Aliquippa[Aliquippa.length] = createMarker(new GPoint(-80.36373901,40.60768890),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Raccoon Elementary School",'Aliquippa=' + Aliquippa.length); Ellwood_City[Ellwood_City.length] = createMarker(new GPoint(-80.25849152,40.83313370),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Riverside High School",'Ellwood_City=' + Ellwood_City.length); Ellwood_City[Ellwood_City.length] = createMarker(new GPoint(-80.25849152,40.83313370),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Riverside Kdg Center",'Ellwood_City=' + Ellwood_City.length); Ellwood_City[Ellwood_City.length] = createMarker(new GPoint(-80.25833893,40.83305740),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Riverside Middle School",'Ellwood_City=' + Ellwood_City.length); Ellwood_City[Ellwood_City.length] = createMarker(new GPoint(-80.25833893,40.83305740),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Riverside Primary Center",'Ellwood_City=' + Ellwood_City.length); Rochester[Rochester.length] = createMarker(new GPoint(-80.27770233,40.70754623),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Rochester Area Elementary School",'Rochester=' + Rochester.length); Rochester[Rochester.length] = createMarker(new GPoint(-80.27770233,40.70754623),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Rochester Area High School",'Rochester=' + Rochester.length); Rochester[Rochester.length] = createMarker(new GPoint(-80.27770233,40.70754623),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Rochester Area Middle School",'Rochester=' + Rochester.length); Industry[Industry.length] = createMarker(new GPoint(-80.42470551,40.67041779),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Snyder Elementary School",'Industry=' + Industry.length); Beaver_Falls[Beaver_Falls.length] = createMarker(new GPoint(-80.31529999,40.75609970),"",iconRd); mySelect.options[mySelect.options.length] = new Option("South Elementary School",'Beaver_Falls=' + Beaver_Falls.length); Hookstown[Hookstown.length] = createMarker(new GPoint(-80.47328186,40.60033035),"",iconRd); mySelect.options[mySelect.options.length] = new Option("South Side Elementary School",'Hookstown=' + Hookstown.length); Hookstown[Hookstown.length] = createMarker(new GPoint(-80.47328186,40.60033035),"",iconGr); mySelect.options[mySelect.options.length] = new Option("South Side High School",'Hookstown=' + Hookstown.length); Hookstown[Hookstown.length] = createMarker(new GPoint(-80.47328186,40.60033035),"",iconBl); mySelect.options[mySelect.options.length] = new Option("South Side Middle School",'Hookstown=' + Hookstown.length); Baden[Baden.length] = createMarker(new GPoint(-80.22369385,40.63096237),"",iconRd); mySelect.options[mySelect.options.length] = new Option("State Street Elementary School",'Baden=' + Baden.length); Monaca[Monaca.length] = createMarker(new GPoint(-80.29916382,40.66550827),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Todd Lane Elementary School",'Monaca=' + Monaca.length); Industry[Industry.length] = createMarker(new GPoint(-80.42449951,40.67065430),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Western Beaver Co Junior Senior High School",'Industry=' + Industry.length); Midland[Midland.length] = createMarker(new GPoint(-80.45494843,40.63803101),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Western Pennsylvania Cyber Charter School",'Midland=' + Midland.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(Aliquippa); map.removeOverlays(Ambridge); map.removeOverlays(Baden); map.removeOverlays(Beaver); map.removeOverlays(Beaver_Falls); map.removeOverlays(Conway); map.removeOverlays(Darlington); map.removeOverlays(Ellwood_City); map.removeOverlays(Freedom); map.removeOverlays(Hookstown); map.removeOverlays(Industry); map.removeOverlays(Koppel); map.removeOverlays(Midland); map.removeOverlays(Monaca); map.removeOverlays(New_Brighton); map.removeOverlays(Rochester); 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(Aliquippa);map.removeOverlays(Aliquippa); map.removeOverlays(Ambridge); map.removeOverlays(Baden); map.removeOverlays(Beaver); map.removeOverlays(Beaver_Falls); map.removeOverlays(Conway); map.removeOverlays(Darlington); map.removeOverlays(Ellwood_City); map.removeOverlays(Freedom); map.removeOverlays(Hookstown); map.removeOverlays(Industry); map.removeOverlays(Koppel); map.removeOverlays(Midland); map.removeOverlays(Monaca); map.removeOverlays(New_Brighton); map.removeOverlays(Rochester); map.addOverlays(Aliquippa); centerByArray(Aliquippa, false, false); cntMarker += Aliquippa.length; map.addOverlays(Ambridge); centerByArray(Ambridge, false, false); cntMarker += Ambridge.length; map.addOverlays(Baden); centerByArray(Baden, false, false); cntMarker += Baden.length; map.addOverlays(Beaver); centerByArray(Beaver, false, false); cntMarker += Beaver.length; map.addOverlays(Beaver_Falls); centerByArray(Beaver_Falls, false, false); cntMarker += Beaver_Falls.length; map.addOverlays(Conway); centerByArray(Conway, false, false); cntMarker += Conway.length; map.addOverlays(Darlington); centerByArray(Darlington, false, false); cntMarker += Darlington.length; map.addOverlays(Ellwood_City); centerByArray(Ellwood_City, false, false); cntMarker += Ellwood_City.length; map.addOverlays(Freedom); centerByArray(Freedom, false, false); cntMarker += Freedom.length; map.addOverlays(Hookstown); centerByArray(Hookstown, false, false); cntMarker += Hookstown.length; map.addOverlays(Industry); centerByArray(Industry, false, false); cntMarker += Industry.length; map.addOverlays(Koppel); centerByArray(Koppel, false, false); cntMarker += Koppel.length; map.addOverlays(Midland); centerByArray(Midland, false, false); cntMarker += Midland.length; map.addOverlays(Monaca); centerByArray(Monaca, false, false); cntMarker += Monaca.length; map.addOverlays(New_Brighton); centerByArray(New_Brighton, false, false); cntMarker += New_Brighton.length; map.addOverlays(Rochester); centerByArray(Rochester, false, false); cntMarker += Rochester.length; centerByArray(Aliquippa,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'); } }