function addMarkers() { mySelect = document.getElementById('selection'); Astoria = [];Seaside = [];Cannon_Beach = [];Gearhart = [];Warrenton = [];mySelect.options[mySelect.options.length] = new Option("Astoria schools",'all=Astoria'); mySelect.options[mySelect.options.length] = new Option("Cannon Beach schools",'all=Cannon_Beach'); mySelect.options[mySelect.options.length] = new Option("Gearhart schools",'all=Gearhart'); mySelect.options[mySelect.options.length] = new Option("Seaside schools",'all=Seaside'); mySelect.options[mySelect.options.length] = new Option("Warrenton schools",'all=Warrenton'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Astoria[Astoria.length] = createMarker(new GPoint(-123.80374146,46.19153595),"
Astor Elementary School
3550 Franklin Ave
Astoria, OR 97103

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Astor Elementary School",'Astoria=' + Astoria.length); Astoria[Astoria.length] = createMarker(new GPoint(-123.83280182,46.17973709),"
Astoria Middle School
1100 Klaskanine Ave
Astoria, OR 97103

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Astoria Middle School",'Astoria=' + Astoria.length); Astoria[Astoria.length] = createMarker(new GPoint(-123.84671021,46.17413330),"
Astoria Senior High School
1001 W Marine Dr
Astoria, OR 97103

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Astoria Senior High School",'Astoria=' + Astoria.length); Seaside[Seaside.length] = createMarker(new GPoint(-123.91918182,45.99333572),"
Broadway Middle School
1120 Broadway St
Seaside, OR 97138

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Broadway Middle School",'Seaside=' + Seaside.length); Cannon_Beach[Cannon_Beach.length] = createMarker(new GPoint(-123.95629883,45.89659882),"
Cannon Beach Elementary School
Po Box 277
Cannon Beach, OR 97110

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Cannon Beach Elementary School",'Cannon_Beach=' + Cannon_Beach.length); Gearhart[Gearhart.length] = createMarker(new GPoint(-123.91418457,46.02433777),"
Gearhart Elementary School
1002 Pacific Way
Gearhart, OR 97138

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Gearhart Elementary School",'Gearhart=' + Gearhart.length); Astoria[Astoria.length] = createMarker(new GPoint(-123.85263062,46.18150711),"
Gray Elementary School
785 Alameda Ave
Astoria, OR 97103

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Gray Elementary School",'Astoria=' + Astoria.length); Astoria[Astoria.length] = createMarker(new GPoint(-123.67571259,46.17092133),"
Hilda Lahti Elementary School
41535 Old Hwy 30
Astoria, OR 97103

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hilda Lahti Elementary School",'Astoria=' + Astoria.length); Seaside[Seaside.length] = createMarker(new GPoint(-123.50070190,45.93254471),"
Jewell School
83874 Hwy 103
Seaside, OR 97138

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Jewell School",'Seaside=' + Seaside.length); Astoria[Astoria.length] = createMarker(new GPoint(-123.67571259,46.17092133),"
Knappa High School
41535 Old Hwy 30
Astoria, OR 97103

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Knappa High School",'Astoria=' + Astoria.length); Astoria[Astoria.length] = createMarker(new GPoint(-123.83174133,46.14632034),"
Lewis & Clark Elementary School
92179 Lewis And Clark Rd
Astoria, OR 97103

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lewis & Clark Elementary School",'Astoria=' + Astoria.length); Astoria[Astoria.length] = createMarker(new GPoint(-123.83090210,46.14680099),"
Olney Elementary School
Rt 1, Box 806
Astoria, OR 97103

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Olney Elementary School",'Astoria=' + Astoria.length); Seaside[Seaside.length] = createMarker(new GPoint(-123.90924072,45.98621368),"
Seaside Heights Elementary School
2000 Spruce St
Seaside, OR 97138

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Seaside Heights Elementary School",'Seaside=' + Seaside.length); Seaside[Seaside.length] = createMarker(new GPoint(-123.91774750,46.00702286),"
Seaside High School
1901 N Holladay Dr
Seaside, OR 97138

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Seaside High School",'Seaside=' + Seaside.length); Warrenton[Warrenton.length] = createMarker(new GPoint(-123.92800140,46.16529846),"
South Jetty High School
1250 Se 19th St
Warrenton, OR 97146

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("South Jetty High School",'Warrenton=' + Warrenton.length); Warrenton[Warrenton.length] = createMarker(new GPoint(-123.93249512,46.15813065),"
Warrenton Grade School
820 Sw Cedar St
Warrenton, OR 97146

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Warrenton Grade School",'Warrenton=' + Warrenton.length); Warrenton[Warrenton.length] = createMarker(new GPoint(-123.92852020,46.14783859),"
Warrenton High School
1700 Se Main
Warrenton, OR 97146

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Warrenton High School",'Warrenton=' + Warrenton.length); Warrenton[Warrenton.length] = createMarker(new GPoint(-123.92800140,46.16529846),"
Warrenton High South Jetty Campus
1250 Se 19th St
Warrenton, OR 97146

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Warrenton High South Jetty Campus",'Warrenton=' + Warrenton.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(Astoria); map.removeOverlays(Cannon_Beach); map.removeOverlays(Gearhart); map.removeOverlays(Seaside); map.removeOverlays(Warrenton); 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(Astoria);map.removeOverlays(Astoria); map.removeOverlays(Cannon_Beach); map.removeOverlays(Gearhart); map.removeOverlays(Seaside); map.removeOverlays(Warrenton); map.addOverlays(Astoria); centerByArray(Astoria, false, false); cntMarker += Astoria.length; map.addOverlays(Cannon_Beach); centerByArray(Cannon_Beach, false, false); cntMarker += Cannon_Beach.length; map.addOverlays(Gearhart); centerByArray(Gearhart, false, false); cntMarker += Gearhart.length; map.addOverlays(Seaside); centerByArray(Seaside, false, false); cntMarker += Seaside.length; map.addOverlays(Warrenton); centerByArray(Warrenton, false, false); cntMarker += Warrenton.length; centerByArray(Astoria,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'); } }