function addMarkers(){ mySelect = document.getElementById('selection'); Culp_Creek = [];Portland = [];Beaverton = [];Toledo = [];Pendleton = [];Ashland = [];Hillsboro = [];Bend = [];Sheridan = [];mySelect.options[mySelect.options.length] = new Option("Ashland schools",'all=Ashland'); mySelect.options[mySelect.options.length] = new Option("Beaverton schools",'all=Beaverton'); mySelect.options[mySelect.options.length] = new Option("Bend schools",'all=Bend'); mySelect.options[mySelect.options.length] = new Option("Culp Creek schools",'all=Culp_Creek'); mySelect.options[mySelect.options.length] = new Option("Hillsboro schools",'all=Hillsboro'); mySelect.options[mySelect.options.length] = new Option("Pendleton schools",'all=Pendleton'); mySelect.options[mySelect.options.length] = new Option("Portland schools",'all=Portland'); mySelect.options[mySelect.options.length] = new Option("Sheridan schools",'all=Sheridan'); mySelect.options[mySelect.options.length] = new Option("Toledo schools",'all=Toledo'); 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); Portland[Portland.length] = createMarker(new GPoint(-122.70733300,45.53664000),"
Class Academy
2730 Nw Vaughn Street
Portland, OR 97210
Co-ed school, PK-7
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Class Academy",'Portland=' + Portland.length); Portland[Portland.length] = createMarker(new GPoint(-122.69227200,45.57855400),"
De La Salle North Catholic High School
7654 N Delaware Avenue
Portland, OR 97217
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("De La Salle North Catholic High School",'Portland=' + Portland.length); Portland[Portland.length] = createMarker(new GPoint(-122.77908000,45.52703000),"
Eduplin Spanish Immersion Christian School
9920 Nw Cornell Road
Portland, OR 97229
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Eduplin Spanish Immersion Christian School",'Portland=' + Portland.length); Portland[Portland.length] = createMarker(new GPoint(-122.76422900,45.52863100),"
French American International School
8500 NW Johnson Street
Portland, OR 97229
Co-ed school, NS-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("French American International School",'Portland=' + Portland.length); Portland[Portland.length] = createMarker(new GPoint(-122.61214700,45.52446100),"
Gately Academy
205 Ne 50th Avenue
Portland, OR 97213
Co-ed school, 4-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Gately Academy",'Portland=' + Portland.length); Beaverton[Beaverton.length] = createMarker(new GPoint(-122.82594200,45.49229200),"
German American School Of Portland
3900 SW Murray Blvd
Beaverton, OR 97005
Co-ed school, PK-5
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("German American School Of Portland",'Beaverton=' + Beaverton.length); Portland[Portland.length] = createMarker(new GPoint(-122.67680500,45.50653100),"
The International School
025 SW Sherman Street
Portland, OR 97201
Co-ed school, PK-5
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The International School",'Portland=' + Portland.length); Toledo[Toledo.length] = createMarker(new GPoint(-123.93131900,44.62791900),"
Nature Discovery School
1127 Ne Highway 20
Toledo, OR 97391
Co-ed school, PK-1
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Nature Discovery School",'Toledo=' + Toledo.length); Pendleton[Pendleton.length] = createMarker(new GPoint(-118.84003700,45.67678500),"
Pendleton Academies
622 Airport Road
Pendleton, OR 97801
Co-ed school, KG-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Pendleton Academies",'Pendleton=' + Pendleton.length); Portland[Portland.length] = createMarker(new GPoint(-122.67667200,45.47852800),"
Portland French School/ Ecole francaise de Portland
6318 Sw Corbett Avenue
Portland, OR 97239
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Portland French School/ Ecole francaise de Portland",'Portland=' + Portland.length); Portland[Portland.length] = createMarker(new GPoint(-122.70375400,45.47614300),"
Portland Jewish Academy
6651 Southwest Capitol Highway
Portland, OR 97219
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Portland Jewish Academy",'Portland=' + Portland.length); Portland[Portland.length] = createMarker(new GPoint(-122.56847500,45.48617100),"
Portland Youth Builders
4816 Se 92nd Avenue
Portland, OR 97266
Co-ed school, 12-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Portland Youth Builders",'Portland=' + Portland.length); Ashland[Ashland.length] = createMarker(new GPoint(-122.67660200,42.18286900),"
The Siskiyou School
631 Clay Street
Ashland, OR 97520
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The Siskiyou School",'Ashland=' + Ashland.length); Hillsboro[Hillsboro.length] = createMarker(new GPoint(-122.95690000,45.49030000),"
Swallowtail School
Po Box 3753
Hillsboro, OR 97123
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Swallowtail School",'Hillsboro=' + Hillsboro.length); Beaverton[Beaverton.length] = createMarker(new GPoint(-122.82899500,45.48884300),"
Valley Catholic School
4275 Sw 148th Avenue
Beaverton, OR 97007
Co-ed school, 7-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Valley Catholic School",'Beaverton=' + Beaverton.length); Bend[Bend.length] = createMarker(new GPoint(-121.31215800,44.09383700),"
Waldorf School of Bend
63175 O B Riley Road
Bend, OR 97701
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Waldorf School of Bend",'Bend=' + Bend.length); Sheridan[Sheridan.length] = createMarker(new GPoint(-123.40762800,45.08643900),"
West Valley Academy
Po Box 127-9015 Dejong Road
Sheridan, OR 97378
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("West Valley Academy",'Sheridan=' + Sheridan.length); map.removeOverlays(Ashland); map.removeOverlays(Beaverton); map.removeOverlays(Bend); map.removeOverlays(Culp_Creek); map.removeOverlays(Hillsboro); map.removeOverlays(Pendleton); map.removeOverlays(Portland); map.removeOverlays(Sheridan); map.removeOverlays(Toledo); setTimeout(function(){map.addOverlays(Ashland)},1000); setTimeout(function(){map.addOverlays(Beaverton)},1000); setTimeout(function(){map.addOverlays(Bend)},1000); setTimeout(function(){map.addOverlays(Culp_Creek)},1000); setTimeout(function(){map.addOverlays(Hillsboro)},1000); setTimeout(function(){map.addOverlays(Pendleton)},1000); setTimeout(function(){map.addOverlays(Portland)},1000); setTimeout(function(){map.addOverlays(Sheridan)},1000); setTimeout(function(){map.addOverlays(Toledo)},1000); maxLng = -118.84003700; maxLat = 45.67678500; minLng = -123.93131900; minLat = 42.18286900; reCenterMap(); } // 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//////' + showArray); map.removeOverlays(Ashland); map.removeOverlays(Beaverton); map.removeOverlays(Bend); map.removeOverlays(Culp_Creek); map.removeOverlays(Hillsboro); map.removeOverlays(Pendleton); map.removeOverlays(Portland); map.removeOverlays(Sheridan); map.removeOverlays(Toledo); 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(Ashland); map.removeOverlays(Beaverton); map.removeOverlays(Bend); map.removeOverlays(Culp_Creek); map.removeOverlays(Hillsboro); map.removeOverlays(Pendleton); map.removeOverlays(Portland); map.removeOverlays(Sheridan); map.removeOverlays(Toledo); map.addOverlays(Ashland); centerByArray(Ashland, false, false); cntMarker += Ashland.length; map.addOverlays(Beaverton); centerByArray(Beaverton, false, false); cntMarker += Beaverton.length; map.addOverlays(Bend); centerByArray(Bend, false, false); cntMarker += Bend.length; map.addOverlays(Culp_Creek); centerByArray(Culp_Creek, false, false); cntMarker += Culp_Creek.length; map.addOverlays(Hillsboro); centerByArray(Hillsboro, false, false); cntMarker += Hillsboro.length; map.addOverlays(Pendleton); centerByArray(Pendleton, false, false); cntMarker += Pendleton.length; map.addOverlays(Portland); centerByArray(Portland, false, false); cntMarker += Portland.length; map.addOverlays(Sheridan); centerByArray(Sheridan, false, false); cntMarker += Sheridan.length; map.addOverlays(Toledo); centerByArray(Toledo, false, false); cntMarker += Toledo.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///22953,31700,30540,34109,36060,34846,22716,34845,22926,30540,35576,31691,22712,35698,22933,35577,22844,22965,35701,/all'); //window.open('/map.php?type=2&schools=22953,31700,30540,34109,36060,34846,22716,34845,22926,30540,35576,31691,22712,35698,22933,35577,22844,22965,35701,&school_level=&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; }