function addMarkers(){ mySelect = document.getElementById('selection'); Pendleton = [];Bend = [];Salem = [];Oregon_City = [];Astoria = [];Portland = [];Eugene = [];Albany = [];Gresham = [];Wilsonville = [];Grants_Pass = [];Coos_Bay = [];Ontario = [];Roseburg = [];mySelect.options[mySelect.options.length] = new Option("Albany Schools",'all=Albany'); mySelect.options[mySelect.options.length] = new Option("Astoria Schools",'all=Astoria'); mySelect.options[mySelect.options.length] = new Option("Bend Schools",'all=Bend'); mySelect.options[mySelect.options.length] = new Option("Coos Bay Schools",'all=Coos_Bay'); mySelect.options[mySelect.options.length] = new Option("Eugene Schools",'all=Eugene'); mySelect.options[mySelect.options.length] = new Option("Grants Pass Schools",'all=Grants_Pass'); mySelect.options[mySelect.options.length] = new Option("Gresham Schools",'all=Gresham'); mySelect.options[mySelect.options.length] = new Option("Ontario Schools",'all=Ontario'); mySelect.options[mySelect.options.length] = new Option("Oregon City Schools",'all=Oregon_City'); 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("Roseburg Schools",'all=Roseburg'); mySelect.options[mySelect.options.length] = new Option("Salem Schools",'all=Salem'); mySelect.options[mySelect.options.length] = new Option("Wilsonville Schools",'all=Wilsonville'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); var tmpLatLng=0; var tmpLen=0; tmpLatLng=new GLatLng(45.67300500000000340,-118.812346000000005); tmpLen=Pendleton.length; Pendleton[tmpLen] = createMarker(tmpLatLng,"
",iconGr); Pendleton[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Blue Mountain Community College",'Pendleton=' + Pendleton.length); tmpLatLng=new GLatLng(44.07539799999999985,-121.348842000000004); tmpLen=Bend.length; Bend[tmpLen] = createMarker(tmpLatLng,"",iconGr); Bend[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Central Oregon Community College",'Bend=' + Bend.length); tmpLatLng=new GLatLng(44.97664699999999982,-122.983421000000006); tmpLen=Salem.length; Salem[tmpLen] = createMarker(tmpLatLng,"",iconGr); Salem[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Chemeketa Community College",'Salem=' + Salem.length); tmpLatLng=new GLatLng(45.32350699999999932,-122.580000999999995); tmpLen=Oregon_City.length; Oregon_City[tmpLen] = createMarker(tmpLatLng,"",iconGr); Oregon_City[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Clackamas Community College",'Oregon_City=' + Oregon_City.length); tmpLatLng=new GLatLng(46.18423200000000150,-123.824494999999998); tmpLen=Astoria.length; Astoria[tmpLen] = createMarker(tmpLatLng,"",iconGr); Astoria[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Clatsop Community College",'Astoria=' + Astoria.length); tmpLatLng=new GLatLng(45.51981299999999919,-122.675752000000002); tmpLen=Portland.length; Portland[tmpLen] = createMarker(tmpLatLng,"",iconRd); Portland[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Everest College",'Portland=' + Portland.length); tmpLatLng=new GLatLng(45.51983100000000348,-122.679590000000004); tmpLen=Portland.length; Portland[tmpLen] = createMarker(tmpLatLng,"",iconRd); Portland[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Heald College-portland",'Portland=' + Portland.length); tmpLatLng=new GLatLng(44.02292299999999869,-123.066588999999993); tmpLen=Eugene.length; Eugene[tmpLen] = createMarker(tmpLatLng,"",iconGr); Eugene[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Lane Community College",'Eugene=' + Eugene.length); tmpLatLng=new GLatLng(44.58804700000000309,-123.109671000000005); tmpLen=Albany.length; Albany[tmpLen] = createMarker(tmpLatLng,"",iconGr); Albany[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Linn-benton Community College",'Albany=' + Albany.length); tmpLatLng=new GLatLng(45.51901000000000152,-122.401009999999999); tmpLen=Gresham.length; Gresham[tmpLen] = createMarker(tmpLatLng,"",iconGr); Gresham[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Mt Hood Community College",'Gresham=' + Gresham.length); tmpLatLng=new GLatLng(45.33185900000000145,-122.768730000000005); tmpLen=Wilsonville.length; Wilsonville[tmpLen] = createMarker(tmpLatLng,"",iconRd); Wilsonville[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Pioneer Pacific College",'Wilsonville=' + Wilsonville.length); tmpLatLng=new GLatLng(45.44124000000000052,-122.726806999999993); tmpLen=Portland.length; Portland[tmpLen] = createMarker(tmpLatLng,"",iconGr); Portland[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Portland Community College",'Portland=' + Portland.length); tmpLatLng=new GLatLng(42.41499900000000167,-123.393260999999995); tmpLen=Grants_Pass.length; Grants_Pass[tmpLen] = createMarker(tmpLatLng,"",iconGr); Grants_Pass[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Rogue Community College",'Grants_Pass=' + Grants_Pass.length); tmpLatLng=new GLatLng(43.39175999999999788,-124.255178000000000); tmpLen=Coos_Bay.length; Coos_Bay[tmpLen] = createMarker(tmpLatLng,"",iconGr); Coos_Bay[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Southwestern Oregon Community College",'Coos_Bay=' + Coos_Bay.length); tmpLatLng=new GLatLng(44.02283800000000013,-116.973235999999999); tmpLen=Ontario.length; Ontario[tmpLen] = createMarker(tmpLatLng,"",iconGr); Ontario[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Treasure Valley Community College",'Ontario=' + Ontario.length); tmpLatLng=new GLatLng(43.22030800000000283,-123.351962000000000); tmpLen=Roseburg.length; Roseburg[tmpLen] = createMarker(tmpLatLng,"",iconGr); Roseburg[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Umpqua Community College",'Roseburg=' + Roseburg.length); map.removeOverlays(Albany); map.removeOverlays(Astoria); map.removeOverlays(Bend); map.removeOverlays(Coos_Bay); map.removeOverlays(Eugene); map.removeOverlays(Grants_Pass); map.removeOverlays(Gresham); map.removeOverlays(Ontario); map.removeOverlays(Oregon_City); map.removeOverlays(Pendleton); map.removeOverlays(Portland); map.removeOverlays(Roseburg); map.removeOverlays(Salem); map.removeOverlays(Wilsonville); setTimeout(function(){map.addOverlays(Albany)},1000); setTimeout(function(){map.addOverlays(Astoria)},1000); setTimeout(function(){map.addOverlays(Bend)},1000); setTimeout(function(){map.addOverlays(Coos_Bay)},1000); setTimeout(function(){map.addOverlays(Eugene)},1000); setTimeout(function(){map.addOverlays(Grants_Pass)},1000); setTimeout(function(){map.addOverlays(Gresham)},1000); setTimeout(function(){map.addOverlays(Ontario)},1000); setTimeout(function(){map.addOverlays(Oregon_City)},1000); setTimeout(function(){map.addOverlays(Pendleton)},1000); setTimeout(function(){map.addOverlays(Portland)},1000); setTimeout(function(){map.addOverlays(Roseburg)},1000); setTimeout(function(){map.addOverlays(Salem)},1000); setTimeout(function(){map.addOverlays(Wilsonville)},1000); getPoly("","state","","OR");} // 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(Albany); map.removeOverlays(Astoria); map.removeOverlays(Bend); map.removeOverlays(Coos_Bay); map.removeOverlays(Eugene); map.removeOverlays(Grants_Pass); map.removeOverlays(Gresham); map.removeOverlays(Ontario); map.removeOverlays(Oregon_City); map.removeOverlays(Pendleton); map.removeOverlays(Portland); map.removeOverlays(Roseburg); map.removeOverlays(Salem); map.removeOverlays(Wilsonville); 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(Pendleton);map.removeOverlays(Albany); map.removeOverlays(Astoria); map.removeOverlays(Bend); map.removeOverlays(Coos_Bay); map.removeOverlays(Eugene); map.removeOverlays(Grants_Pass); map.removeOverlays(Gresham); map.removeOverlays(Ontario); map.removeOverlays(Oregon_City); map.removeOverlays(Pendleton); map.removeOverlays(Portland); map.removeOverlays(Roseburg); map.removeOverlays(Salem); map.removeOverlays(Wilsonville); map.addOverlays(Albany); centerByArray(Albany, false, false); cntMarker += Albany.length; map.addOverlays(Astoria); centerByArray(Astoria, false, false); cntMarker += Astoria.length; map.addOverlays(Bend); centerByArray(Bend, false, false); cntMarker += Bend.length; map.addOverlays(Coos_Bay); centerByArray(Coos_Bay, false, false); cntMarker += Coos_Bay.length; map.addOverlays(Eugene); centerByArray(Eugene, false, false); cntMarker += Eugene.length; map.addOverlays(Grants_Pass); centerByArray(Grants_Pass, false, false); cntMarker += Grants_Pass.length; map.addOverlays(Gresham); centerByArray(Gresham, false, false); cntMarker += Gresham.length; map.addOverlays(Ontario); centerByArray(Ontario, false, false); cntMarker += Ontario.length; map.addOverlays(Oregon_City); centerByArray(Oregon_City, false, false); cntMarker += Oregon_City.length; map.addOverlays(Pendleton); centerByArray(Pendleton, false, false); cntMarker += Pendleton.length; map.addOverlays(Portland); centerByArray(Portland, false, false); cntMarker += Portland.length; map.addOverlays(Roseburg); centerByArray(Roseburg, false, false); cntMarker += Roseburg.length; map.addOverlays(Salem); centerByArray(Salem, false, false); cntMarker += Salem.length; map.addOverlays(Wilsonville); centerByArray(Wilsonville, false, false); cntMarker += Wilsonville.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; }