function addMarkers() { mySelect = document.getElementById('selection'); Vancouver = [];Port_Angeles = [];Seattle = [];Kennewick = [];Spokane = [];Lynnwood = [];Tumwater = [];Wenatchee = [];Everett = [];Bremeron = [];Yakima = [];mySelect.options[mySelect.options.length] = new Option("Bremeron vocational schools",'all=Bremeron'); mySelect.options[mySelect.options.length] = new Option("Everett vocational schools",'all=Everett'); mySelect.options[mySelect.options.length] = new Option("Kennewick vocational schools",'all=Kennewick'); mySelect.options[mySelect.options.length] = new Option("Lynnwood vocational schools",'all=Lynnwood'); mySelect.options[mySelect.options.length] = new Option("Port Angeles vocational schools",'all=Port_Angeles'); mySelect.options[mySelect.options.length] = new Option("Seattle vocational schools",'all=Seattle'); mySelect.options[mySelect.options.length] = new Option("Spokane vocational schools",'all=Spokane'); mySelect.options[mySelect.options.length] = new Option("Tumwater vocational schools",'all=Tumwater'); mySelect.options[mySelect.options.length] = new Option("Vancouver vocational schools",'all=Vancouver'); mySelect.options[mySelect.options.length] = new Option("Wenatchee vocational schools",'all=Wenatchee'); mySelect.options[mySelect.options.length] = new Option("Yakima vocational schools",'all=Yakima'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Vancouver[Vancouver.length] = createMarker(new GPoint(-122.54777527,45.64303589),"
Clark County Vocational Skills Center
12200 Ne 28th Street
Vancouver, WA 98682

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Clark County Vocational Skills Center",'Vancouver=' + Vancouver.length); Port_Angeles[Port_Angeles.length] = createMarker(new GPoint(-123.44060516,48.10146332),"
N Olympic Peninsula Skill Consor High School
905 W 9th St
Port Angeles, WA 98363

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("N Olympic Peninsula Skill Consor High School",'Port_Angeles=' + Port_Angeles.length); Seattle[Seattle.length] = createMarker(new GPoint(-122.32378387,47.44045258),"
Occupational Skills Center
18010 8th Ave S
Seattle, WA 98148

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Occupational Skills Center",'Seattle=' + Seattle.length); Kennewick[Kennewick.length] = createMarker(new GPoint(-119.20006561,46.21956253),"
Tri City Area Vocational Skills Center
5929 West Metaline Avenue
Kennewick, WA 99336

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Tri City Area Vocational Skills Center",'Kennewick=' + Kennewick.length); Spokane[Spokane.length] = createMarker(new GPoint(-117.36830139,47.69535446),"
Voc Skills Center Spokane
N 4141 Regal Street
Spokane, WA 99207

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Voc Skills Center Spokane",'Spokane=' + Spokane.length); Lynnwood[Lynnwood.length] = createMarker(new GPoint(-122.32499695,47.81379318),"
Vocational Ed Intra-district High School
20420 68th Ave W
Lynnwood, WA 98036

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Vocational Ed Intra-district High School",'Lynnwood=' + Lynnwood.length); Tumwater[Tumwater.length] = createMarker(new GPoint(-122.91320038,46.96707916),"
Vocational Skills Center New Market
7299 New Market Street
Tumwater, WA 98501

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Vocational Skills Center New Market",'Tumwater=' + Tumwater.length); Wenatchee[Wenatchee.length] = createMarker(new GPoint(-120.32939148,47.46583939),"
Vocational Skills Center North Central
327 E Penny Road Ste D
Wenatchee, WA 98801

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Vocational Skills Center North Central",'Wenatchee=' + Wenatchee.length); Everett[Everett.length] = createMarker(new GPoint(-122.27149200,47.91752625),"
Vocational Skills Center Sno-isle
9001 Airport Road
Everett, WA 98204

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Vocational Skills Center Sno-isle",'Everett=' + Everett.length); Bremeron[Bremeron.length] = createMarker(new GPoint(-122.66799164,47.56375885),"
West Sound Technical Skills Center
101 National Avenue
Bremeron, WA 98312

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("West Sound Technical Skills Center",'Bremeron=' + Bremeron.length); Yakima[Yakima.length] = createMarker(new GPoint(-120.52919769,46.58481598),"
Yakima Valley Technical Skills Center
1116 S 15th Ave
Yakima, WA 98902

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Yakima Valley Technical Skills Center",'Yakima=' + Yakima.length); maxLng = -117.36830139; maxLat = 48.10146332; minLng = -123.44060516; minLat = 45.64303589; reCenterMap(); map.removeOverlays(Bremeron); map.removeOverlays(Everett); map.removeOverlays(Kennewick); map.removeOverlays(Lynnwood); map.removeOverlays(Port_Angeles); map.removeOverlays(Seattle); map.removeOverlays(Spokane); map.removeOverlays(Tumwater); map.removeOverlays(Vancouver); map.removeOverlays(Wenatchee); map.removeOverlays(Yakima); setTimeout(function(){map.addOverlays(Bremeron)},1000); setTimeout(function(){map.addOverlays(Everett)},1000); setTimeout(function(){map.addOverlays(Kennewick)},1000); setTimeout(function(){map.addOverlays(Lynnwood)},1000); setTimeout(function(){map.addOverlays(Port_Angeles)},1000); setTimeout(function(){map.addOverlays(Seattle)},1000); setTimeout(function(){map.addOverlays(Spokane)},1000); setTimeout(function(){map.addOverlays(Tumwater)},1000); setTimeout(function(){map.addOverlays(Vancouver)},1000); setTimeout(function(){map.addOverlays(Wenatchee)},1000); setTimeout(function(){map.addOverlays(Yakima)},1000); } // 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(Bremeron); map.removeOverlays(Everett); map.removeOverlays(Kennewick); map.removeOverlays(Lynnwood); map.removeOverlays(Port_Angeles); map.removeOverlays(Seattle); map.removeOverlays(Spokane); map.removeOverlays(Tumwater); map.removeOverlays(Vancouver); map.removeOverlays(Wenatchee); map.removeOverlays(Yakima); 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(Vancouver);map.removeOverlays(Bremeron); map.removeOverlays(Everett); map.removeOverlays(Kennewick); map.removeOverlays(Lynnwood); map.removeOverlays(Port_Angeles); map.removeOverlays(Seattle); map.removeOverlays(Spokane); map.removeOverlays(Tumwater); map.removeOverlays(Vancouver); map.removeOverlays(Wenatchee); map.removeOverlays(Yakima); map.addOverlays(Bremeron); centerByArray(Bremeron, false, false); cntMarker += Bremeron.length; map.addOverlays(Everett); centerByArray(Everett, false, false); cntMarker += Everett.length; map.addOverlays(Kennewick); centerByArray(Kennewick, false, false); cntMarker += Kennewick.length; map.addOverlays(Lynnwood); centerByArray(Lynnwood, false, false); cntMarker += Lynnwood.length; map.addOverlays(Port_Angeles); centerByArray(Port_Angeles, false, false); cntMarker += Port_Angeles.length; map.addOverlays(Seattle); centerByArray(Seattle, false, false); cntMarker += Seattle.length; map.addOverlays(Spokane); centerByArray(Spokane, false, false); cntMarker += Spokane.length; map.addOverlays(Tumwater); centerByArray(Tumwater, false, false); cntMarker += Tumwater.length; map.addOverlays(Vancouver); centerByArray(Vancouver, false, false); cntMarker += Vancouver.length; map.addOverlays(Wenatchee); centerByArray(Wenatchee, false, false); cntMarker += Wenatchee.length; map.addOverlays(Yakima); centerByArray(Yakima, false, false); cntMarker += Yakima.length; centerByArray(Vancouver,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'); } }