function addMarkers() { mySelect = document.getElementById('selection'); Linesville = [];Cambridge_Springs = [];Titusville = [];Cochranton = [];Conneaut_Lake = [];Conneautville = [];Meadville = [];Saegertown = [];Jamestown = [];Townville = [];Guys_Mills = [];mySelect.options[mySelect.options.length] = new Option("Cambridge Springs schools",'all=Cambridge_Springs'); mySelect.options[mySelect.options.length] = new Option("Cochranton schools",'all=Cochranton'); mySelect.options[mySelect.options.length] = new Option("Conneaut Lake schools",'all=Conneaut_Lake'); mySelect.options[mySelect.options.length] = new Option("Conneautville schools",'all=Conneautville'); mySelect.options[mySelect.options.length] = new Option("Guys Mills schools",'all=Guys_Mills'); mySelect.options[mySelect.options.length] = new Option("Jamestown schools",'all=Jamestown'); mySelect.options[mySelect.options.length] = new Option("Linesville schools",'all=Linesville'); mySelect.options[mySelect.options.length] = new Option("Meadville schools",'all=Meadville'); mySelect.options[mySelect.options.length] = new Option("Saegertown schools",'all=Saegertown'); mySelect.options[mySelect.options.length] = new Option("Titusville schools",'all=Titusville'); mySelect.options[mySelect.options.length] = new Option("Townville schools",'all=Townville'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Linesville[Linesville.length] = createMarker(new GPoint(-80.41851807,41.65473557),"
Alice Schafer Elementary School
220 W School Dr
Linesville, PA 16424

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Alice Schafer Elementary School",'Linesville=' + Linesville.length); Cambridge_Springs[Cambridge_Springs.length] = createMarker(new GPoint(-80.06545258,41.79952621),"
Cambridge Springs Elementary School
130 Steele St
Cambridge Springs, PA 16403

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Cambridge Springs Elementary School",'Cambridge_Springs=' + Cambridge_Springs.length); Cambridge_Springs[Cambridge_Springs.length] = createMarker(new GPoint(-80.06266022,41.80199814),"
Cambridge Springs Junior Senior High School
Venango Avenue
Cambridge Springs, PA 16403

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Cambridge Springs Junior Senior High School",'Cambridge_Springs=' + Cambridge_Springs.length); Titusville[Titusville.length] = createMarker(new GPoint(-79.76841736,41.58631897),"
Cherrytree Elementary School
1260 Cherrytree Rd
Titusville, PA 16354

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Cherrytree Elementary School",'Titusville=' + Titusville.length); Cochranton[Cochranton.length] = createMarker(new GPoint(-80.04092407,41.51105118),"
Cochranton Elementary School
225 South Franklin Street
Cochranton, PA 16314

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Cochranton Elementary School",'Cochranton=' + Cochranton.length); Cochranton[Cochranton.length] = createMarker(new GPoint(-80.04070282,41.52199936),"
Cochranton Junior Senior High School
P O Box 127
Cochranton, PA 16314

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Cochranton Junior Senior High School",'Cochranton=' + Cochranton.length); Conneaut_Lake[Conneaut_Lake.length] = createMarker(new GPoint(-80.32880402,41.60887527),"
Conneaut Lake High School
10331 Us Highway 6
Conneaut Lake, PA 16316

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Conneaut Lake High School",'Conneaut_Lake=' + Conneaut_Lake.length); Conneaut_Lake[Conneaut_Lake.length] = createMarker(new GPoint(-80.30799866,41.60459900),"
Conneaut Lake-sadsbury Elementary School
630 Line Street Box Ab
Conneaut Lake, PA 16316

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Conneaut Lake-sadsbury Elementary School",'Conneaut_Lake=' + Conneaut_Lake.length); Conneautville[Conneautville.length] = createMarker(new GPoint(-80.36428070,41.77869415),"
Conneaut Valley Elementary School
22361 State Highway 18
Conneautville, PA 16406

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Conneaut Valley Elementary School",'Conneautville=' + Conneautville.length); Conneautville[Conneautville.length] = createMarker(new GPoint(-80.36411285,41.77599335),"
Conneaut Valley High School
22154 State Highway 18
Conneautville, PA 16406

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Conneaut Valley High School",'Conneautville=' + Conneautville.length); Meadville[Meadville.length] = createMarker(new GPoint(-80.15470123,41.63119888),"
Crawford County Avts
860 Thurston Rd
Meadville, PA 16335

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Crawford County Avts",'Meadville=' + Meadville.length); Saegertown[Saegertown.length] = createMarker(new GPoint(-80.21965790,41.80026627),"
Cussewago Elementary School
23761 N Mosiertown Rd
Saegertown, PA 16433

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Cussewago Elementary School",'Saegertown=' + Saegertown.length); Titusville[Titusville.length] = createMarker(new GPoint(-79.66839600,41.63086319),"
Early Childhood Learning Center
330 E Spruce St
Titusville, PA 16354

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Early Childhood Learning Center",'Titusville=' + Titusville.length); Meadville[Meadville.length] = createMarker(new GPoint(-80.13829803,41.63681793),"
East End Elementary School
640 Walnut St
Meadville, PA 16335

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("East End Elementary School",'Meadville=' + Meadville.length); Meadville[Meadville.length] = createMarker(new GPoint(-80.13521576,41.66649246),"
First District Elementary School
725 N Main St
Meadville, PA 16335

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("First District Elementary School",'Meadville=' + Meadville.length); Conneaut_Lake[Conneaut_Lake.length] = createMarker(new GPoint(-80.29351807,41.57840347),"
Greenwood Elementary School
15161 State Highway 285
Conneaut Lake, PA 16316

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Greenwood Elementary School",'Conneaut_Lake=' + Conneaut_Lake.length); Titusville[Titusville.length] = createMarker(new GPoint(-79.72013092,41.64551926),"
Hydetown Elementary School
12294 Gresham Road
Titusville, PA 16354

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hydetown Elementary School",'Titusville=' + Titusville.length); Jamestown[Jamestown.length] = createMarker(new GPoint(-80.47070312,41.52259827),"
Jamestown Area Elementary School
Po Box 217
Jamestown, PA 16134

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Jamestown Area Elementary School",'Jamestown=' + Jamestown.length); Linesville[Linesville.length] = createMarker(new GPoint(-80.41906738,41.65473557),"
Linesville-conneaut-summit High School
302 W School Dr
Linesville, PA 16424

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Linesville-conneaut-summit High School",'Linesville=' + Linesville.length); Titusville[Titusville.length] = createMarker(new GPoint(-79.67382812,41.62816238),"
Main Street Elementary School
117 W Main St
Titusville, PA 16354

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Main Street Elementary School",'Titusville=' + Titusville.length); Townville[Townville.length] = createMarker(new GPoint(-79.89334106,41.68476486),"
Maplewood Elementary School
32695 State Highway 408
Townville, PA 16360

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Maplewood Elementary School",'Townville=' + Townville.length); Guys_Mills[Guys_Mills.length] = createMarker(new GPoint(-79.91816711,41.66730118),"
Maplewood Junior Senior High School
30383 Guys Mills Rd
Guys Mills, PA 16327

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Maplewood Junior Senior High School",'Guys_Mills=' + Guys_Mills.length); Meadville[Meadville.length] = createMarker(new GPoint(-80.12847137,41.63554001),"
Meadville Area Senior High School
930 North St
Meadville, PA 16335

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Meadville Area Senior High School",'Meadville=' + Meadville.length); Meadville[Meadville.length] = createMarker(new GPoint(-80.12645721,41.63517380),"
Meadville Middle School
979 North St
Meadville, PA 16335

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Meadville Middle School",'Meadville=' + Meadville.length); Meadville[Meadville.length] = createMarker(new GPoint(-80.13674164,41.62098312),"
Neason Hill Elementary School
11293 Williamson Rd
Meadville, PA 16335

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Neason Hill Elementary School",'Meadville=' + Meadville.length); Saegertown[Saegertown.length] = createMarker(new GPoint(-80.16603088,41.72456360),"
Saegertown Elementary School
18741 State Highway 198
Saegertown, PA 16433

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Saegertown Elementary School",'Saegertown=' + Saegertown.length); Saegertown[Saegertown.length] = createMarker(new GPoint(-80.16522217,41.71991348),"
Saegertown Junior Senior High School
18079 Mook Road
Saegertown, PA 16433

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Saegertown Junior Senior High School",'Saegertown=' + Saegertown.length); Meadville[Meadville.length] = createMarker(new GPoint(-80.15346527,41.63007736),"
Second District Elementary School
1216 S Main St
Meadville, PA 16335

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Second District Elementary School",'Meadville=' + Meadville.length); Titusville[Titusville.length] = createMarker(new GPoint(-79.72628021,41.65159988),"
Titusville Middle School
415 Water Street
Titusville, PA 16354

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Titusville Middle School",'Titusville=' + Titusville.length); Titusville[Titusville.length] = createMarker(new GPoint(-79.66938782,41.62964630),"
Titusville Senior High School
302 E Walnut St
Titusville, PA 16354

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Titusville Senior High School",'Titusville=' + Titusville.length); Meadville[Meadville.length] = createMarker(new GPoint(-80.23680115,41.63288879),"
West End Elementary School
12068 Brooks Rd
Meadville, PA 16335

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("West End Elementary School",'Meadville=' + Meadville.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(Cambridge_Springs); map.removeOverlays(Cochranton); map.removeOverlays(Conneaut_Lake); map.removeOverlays(Conneautville); map.removeOverlays(Guys_Mills); map.removeOverlays(Jamestown); map.removeOverlays(Linesville); map.removeOverlays(Meadville); map.removeOverlays(Saegertown); map.removeOverlays(Titusville); map.removeOverlays(Townville); 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(Linesville);map.removeOverlays(Cambridge_Springs); map.removeOverlays(Cochranton); map.removeOverlays(Conneaut_Lake); map.removeOverlays(Conneautville); map.removeOverlays(Guys_Mills); map.removeOverlays(Jamestown); map.removeOverlays(Linesville); map.removeOverlays(Meadville); map.removeOverlays(Saegertown); map.removeOverlays(Titusville); map.removeOverlays(Townville); map.addOverlays(Cambridge_Springs); centerByArray(Cambridge_Springs, false, false); cntMarker += Cambridge_Springs.length; map.addOverlays(Cochranton); centerByArray(Cochranton, false, false); cntMarker += Cochranton.length; map.addOverlays(Conneaut_Lake); centerByArray(Conneaut_Lake, false, false); cntMarker += Conneaut_Lake.length; map.addOverlays(Conneautville); centerByArray(Conneautville, false, false); cntMarker += Conneautville.length; map.addOverlays(Guys_Mills); centerByArray(Guys_Mills, false, false); cntMarker += Guys_Mills.length; map.addOverlays(Jamestown); centerByArray(Jamestown, false, false); cntMarker += Jamestown.length; map.addOverlays(Linesville); centerByArray(Linesville, false, false); cntMarker += Linesville.length; map.addOverlays(Meadville); centerByArray(Meadville, false, false); cntMarker += Meadville.length; map.addOverlays(Saegertown); centerByArray(Saegertown, false, false); cntMarker += Saegertown.length; map.addOverlays(Titusville); centerByArray(Titusville, false, false); cntMarker += Titusville.length; map.addOverlays(Townville); centerByArray(Townville, false, false); cntMarker += Townville.length; centerByArray(Linesville,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'); } }