function addMarkers(){ mySelect = document.getElementById('selection'); Culp_Creek = [];Creswell = [];Pleasant_Hill = [];Cottage_Grove = [];Eugene = [];Springfield = [];mySelect.options[mySelect.options.length] = new Option("Cottage Grove schools",'all=Cottage_Grove'); mySelect.options[mySelect.options.length] = new Option("Creswell schools",'all=Creswell'); mySelect.options[mySelect.options.length] = new Option("Culp Creek schools",'all=Culp_Creek'); mySelect.options[mySelect.options.length] = new Option("Eugene schools",'all=Eugene'); mySelect.options[mySelect.options.length] = new Option("Pleasant Hill schools",'all=Pleasant_Hill'); mySelect.options[mySelect.options.length] = new Option("Springfield schools",'all=Springfield'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Culp_Creek[Culp_Creek.length] = createMarker(new GPoint(-122.84529400,43.70007600),"
Child's Way Culp Creek School
37895 Row River Road
Culp Creek, OR 97427
Co-ed school, 7-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Child's Way Culp Creek School",'Culp_Creek=' + Culp_Creek.length); Creswell[Creswell.length] = createMarker(new GPoint(-123.02380000,43.90750000),"
Creswell Christian School
Po Box 217
Creswell, OR 97426
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Creswell Christian School",'Creswell=' + Creswell.length); Pleasant_Hill[Pleasant_Hill.length] = createMarker(new GPoint(-122.94922800,43.97980400),"
Emerald Christian Academy
35582 Zephyr Way
Pleasant Hill, OR 97455
Co-ed school, NS-10
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Emerald Christian Academy",'Pleasant_Hill=' + Pleasant_Hill.length); Cottage_Grove[Cottage_Grove.length] = createMarker(new GPoint(-122.98348900,43.73649300),"
Faith Christian School
76132 Blue Mountain School Rd
Cottage Grove, OR 97424
Co-ed school, 1-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Faith Christian School",'Cottage_Grove=' + Cottage_Grove.length); Eugene[Eugene.length] = createMarker(new GPoint(-123.14885800,44.07220600),"
Lifegate Christian School Dba
1052 Fairfield Ave
Eugene, OR 97402
Co-ed school, 6-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Lifegate Christian School Dba",'Eugene=' + Eugene.length); Eugene[Eugene.length] = createMarker(new GPoint(-123.10680600,44.05229800),"
Looking Glass - New Roads School
941 W 7th Avenue
Eugene, OR 97402
Co-ed school, 8-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Looking Glass - New Roads School",'Eugene=' + Eugene.length); Eugene[Eugene.length] = createMarker(new GPoint(-123.11976600,44.04757900),"
Looking Glass Center Point School
1790 W 11th Avenue
Eugene, OR 97402
Co-ed school, 6-11
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Looking Glass Center Point School",'Eugene=' + Eugene.length); Eugene[Eugene.length] = createMarker(new GPoint(-123.07112800,44.04698200),"
Looking Glass Riverfront School
1475 Franklin Blvd
Eugene, OR 97403
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Looking Glass Riverfront School",'Eugene=' + Eugene.length); Eugene[Eugene.length] = createMarker(new GPoint(-123.07027700,44.06002200),"
Looking Glass Stepping Stone Program School
2517 Martin Luther King Jr Blvd
Eugene, OR 97401
All-boys school, 9-12
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Looking Glass Stepping Stone Program School",'Eugene=' + Eugene.length); Eugene[Eugene.length] = createMarker(new GPoint(-123.11441900,44.08506900),"
Marist High School
1900 Kingsley Road
Eugene, OR 97401
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Marist High School",'Eugene=' + Eugene.length); Eugene[Eugene.length] = createMarker(new GPoint(-123.02830400,44.01250500),"
Oak Hill School
86397 Eldon Schafer Drive
Eugene, OR 97405
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Oak Hill School",'Eugene=' + Eugene.length); Cottage_Grove[Cottage_Grove.length] = createMarker(new GPoint(-123.05535900,43.78749000),"
South Lane Christian School
P.O.Box 1504
Cottage Grove, OR 97424
Co-ed school, 1-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("South Lane Christian School",'Cottage_Grove=' + Cottage_Grove.length); Springfield[Springfield.length] = createMarker(new GPoint(-122.99411000,44.05913700),"
United States Basketball Institute
1623 21st Street
Springfield, OR 97477
All-boys school, 9-11
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("United States Basketball Institute",'Springfield=' + Springfield.length); Eugene[Eugene.length] = createMarker(new GPoint(-123.14590500,44.04059300),"
Wellsprings Friends School
3590 W 18th Avenue
Eugene, OR 97402
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Wellsprings Friends School",'Eugene=' + Eugene.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,11); /* 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/////2/' + showArray); map.removeOverlays(Cottage_Grove); map.removeOverlays(Creswell); map.removeOverlays(Culp_Creek); map.removeOverlays(Eugene); map.removeOverlays(Pleasant_Hill); map.removeOverlays(Springfield); 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(Culp_Creek);map.removeOverlays(Cottage_Grove); map.removeOverlays(Creswell); map.removeOverlays(Culp_Creek); map.removeOverlays(Eugene); map.removeOverlays(Pleasant_Hill); map.removeOverlays(Springfield); map.addOverlays(Cottage_Grove); centerByArray(Cottage_Grove, false, false); cntMarker += Cottage_Grove.length; map.addOverlays(Creswell); centerByArray(Creswell, false, false); cntMarker += Creswell.length; map.addOverlays(Culp_Creek); centerByArray(Culp_Creek, false, false); cntMarker += Culp_Creek.length; map.addOverlays(Eugene); centerByArray(Eugene, false, false); cntMarker += Eugene.length; map.addOverlays(Pleasant_Hill); centerByArray(Pleasant_Hill, false, false); cntMarker += Pleasant_Hill.length; map.addOverlays(Springfield); centerByArray(Springfield, false, false); cntMarker += Springfield.length; centerByArray(Culp_Creek,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'); //window.open('/map.php?type=1&schools=&school_level=2&radius=&zipcode=&school_type_search=&school_type_code='); } } function createMarker(point, label, icon) { var marker = new GMarker(point, icon); var html = label; GEvent.addListener(marker, "click", function() { marker.openInfoWindowHtml(html); }); return marker; }