function addMarkers(){ mySelect = document.getElementById('selection'); Seattle = [];Bellevue = [];Auburn = [];Des_Moines = [];Kirkland = [];Renton = [];Shoreline = [];mySelect.options[mySelect.options.length] = new Option("Auburn Schools",'all=Auburn'); mySelect.options[mySelect.options.length] = new Option("Bellevue Schools",'all=Bellevue'); mySelect.options[mySelect.options.length] = new Option("Des Moines Schools",'all=Des_Moines'); mySelect.options[mySelect.options.length] = new Option("Kirkland Schools",'all=Kirkland'); mySelect.options[mySelect.options.length] = new Option("Renton Schools",'all=Renton'); mySelect.options[mySelect.options.length] = new Option("Seattle Schools",'all=Seattle'); mySelect.options[mySelect.options.length] = new Option("Shoreline Schools",'all=Shoreline'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); var tmpLatLng=0; var tmpLen=0; tmpLatLng=new GLatLng(47.61245499999999708,-122.348252000000002); tmpLen=Seattle.length; Seattle[tmpLen] = createMarker(tmpLatLng,"
Art Institute Of Seattle
2323 Elliott Ave
Seattle, WA 98121

[ View School Profile ]
",iconRd); Seattle[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Art Institute Of Seattle",'Seattle=' + Seattle.length); tmpLatLng=new GLatLng(47.58402099999999990,-122.146005000000002); tmpLen=Bellevue.length; Bellevue[tmpLen] = createMarker(tmpLatLng,"
Bellevue Community College
3000 Landerholm Cir Se
Bellevue, WA 98007

[ View School Profile ]
",iconGr); Bellevue[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Bellevue Community College",'Bellevue=' + Bellevue.length); tmpLatLng=new GLatLng(47.31532200000000187,-122.175629000000000); tmpLen=Auburn.length; Auburn[tmpLen] = createMarker(tmpLatLng,"
Green River Community College
12401 Se 320th St
Auburn, WA 98092

[ View School Profile ]
",iconGr); Auburn[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Green River Community College",'Auburn=' + Auburn.length); tmpLatLng=new GLatLng(47.38652799999999842,-122.302876999999995); tmpLen=Des_Moines.length; Des_Moines[tmpLen] = createMarker(tmpLatLng,"
Highline Community College
2400 S 240th St
Des Moines, WA 98198

[ View School Profile ]
",iconGr); Des_Moines[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Highline Community College",'Des_Moines=' + Des_Moines.length); tmpLatLng=new GLatLng(47.70225700000000301,-122.164325000000005); tmpLen=Kirkland.length; Kirkland[tmpLen] = createMarker(tmpLatLng,"
Lake Washington Technical College
11605 132nd Ave Ne
Kirkland, WA 98034

[ View School Profile ]
",iconGr); Kirkland[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Lake Washington Technical College",'Kirkland=' + Kirkland.length); tmpLatLng=new GLatLng(47.48842199999999991,-122.180632000000002); tmpLen=Renton.length; Renton[tmpLen] = createMarker(tmpLatLng,"
Renton Technical College
3000 Ne Fourth St
Renton, WA 98056

[ View School Profile ]
",iconGr); Renton[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Renton Technical College",'Renton=' + Renton.length); tmpLatLng=new GLatLng(47.61654300000000006,-122.320735999999996); tmpLen=Seattle.length; Seattle[tmpLen] = createMarker(tmpLatLng,"
Seattle Community College-central Campus
1701 Broadway Avenue
Seattle, WA 98122

[ View School Profile ]
",iconGr); Seattle[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Seattle Community College-central Campus",'Seattle=' + Seattle.length); tmpLatLng=new GLatLng(47.69877999999999929,-122.335037999999997); tmpLen=Seattle.length; Seattle[tmpLen] = createMarker(tmpLatLng,"
Seattle Community College-north Campus
9600 College Way North
Seattle, WA 98103

[ View School Profile ]
",iconGr); Seattle[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Seattle Community College-north Campus",'Seattle=' + Seattle.length); tmpLatLng=new GLatLng(47.54845900000000114,-122.354636999999996); tmpLen=Seattle.length; Seattle[tmpLen] = createMarker(tmpLatLng,"
Seattle Community College-south Campus
6000 16th Ave Sw
Seattle, WA 98106

[ View School Profile ]
",iconGr); Seattle[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Seattle Community College-south Campus",'Seattle=' + Seattle.length); tmpLatLng=new GLatLng(47.74616199999999821,-122.355840000000000); tmpLen=Shoreline.length; Shoreline[tmpLen] = createMarker(tmpLatLng,"
Shoreline Community College
16101 Greenwood Ave N
Shoreline, WA 98133

[ View School Profile ]
",iconGr); Shoreline[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Shoreline Community College",'Shoreline=' + Shoreline.length); map.removeOverlays(Auburn); map.removeOverlays(Bellevue); map.removeOverlays(Des_Moines); map.removeOverlays(Kirkland); map.removeOverlays(Renton); map.removeOverlays(Seattle); map.removeOverlays(Shoreline); setTimeout(function(){map.addOverlays(Auburn)},1000); setTimeout(function(){map.addOverlays(Bellevue)},1000); setTimeout(function(){map.addOverlays(Des_Moines)},1000); setTimeout(function(){map.addOverlays(Kirkland)},1000); setTimeout(function(){map.addOverlays(Renton)},1000); setTimeout(function(){map.addOverlays(Seattle)},1000); setTimeout(function(){map.addOverlays(Shoreline)},1000); maxLng = -122.146005000000002; maxLat = 47.74616199999999821; minLng = -122.355840000000000; minLat = 47.31532200000000187; reCenterMap(); } // End addStateMarkers JavaScript Function //open all when map is defined function openAll() { if (map) { selectChange("all"); } else { setTimeout("openAll()",200); } } // 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].point.x; var markLat = myArray[i].point.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].point.x; maxLat = myArray[0].point.y; minLng = myArray[0].point.x; minLat = myArray[0].point.y; } // Recenter map based on global max/mins function reCenterMap(){ //alert('#' + minLat + '#' + minLng + '#' + maxLat + '#' + maxLng); 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) { if (selection.options) { var _openNewWindow=true; var myVal = selection.options[selection.selectedIndex].value; } else { var _openNewWindow=false; var myVal=selection; } 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('schools-by-distance') == -1) window.open(location.href + '/map/all'); else window.open('/search////all'); map.removeOverlays(Auburn); map.removeOverlays(Bellevue); map.removeOverlays(Des_Moines); map.removeOverlays(Kirkland); map.removeOverlays(Renton); map.removeOverlays(Seattle); map.removeOverlays(Shoreline); 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(Seattle);map.removeOverlays(Auburn); map.removeOverlays(Bellevue); map.removeOverlays(Des_Moines); map.removeOverlays(Kirkland); map.removeOverlays(Renton); map.removeOverlays(Seattle); map.removeOverlays(Shoreline); map.addOverlays(Auburn); centerByArray(Auburn, false, false); cntMarker += Auburn.length; map.addOverlays(Bellevue); centerByArray(Bellevue, false, false); cntMarker += Bellevue.length; map.addOverlays(Des_Moines); centerByArray(Des_Moines, false, false); cntMarker += Des_Moines.length; map.addOverlays(Kirkland); centerByArray(Kirkland, false, false); cntMarker += Kirkland.length; map.addOverlays(Renton); centerByArray(Renton, false, false); cntMarker += Renton.length; map.addOverlays(Seattle); centerByArray(Seattle, false, false); cntMarker += Seattle.length; map.addOverlays(Shoreline); centerByArray(Shoreline, false, false); cntMarker += Shoreline.length; reCenterMap(); //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'); } } function createMarker(point, label, icon){ var marker = new GMarker(point, icon); var html = label; GEvent.addListener(marker, "click", function() { marker.openInfoWindowHtml(html); }); return marker; }