function addMarkers() { mySelect = document.getElementById('selection'); Parachute = [];Glenwood_Springs = [];Woody_Creek = [];Carbondale = [];New_Castle = [];Rifle = [];Silt = [];mySelect.options[mySelect.options.length] = new Option("Carbondale schools",'all=Carbondale'); mySelect.options[mySelect.options.length] = new Option("Glenwood Springs schools",'all=Glenwood_Springs'); mySelect.options[mySelect.options.length] = new Option("New Castle schools",'all=New_Castle'); mySelect.options[mySelect.options.length] = new Option("Parachute schools",'all=Parachute'); mySelect.options[mySelect.options.length] = new Option("Rifle schools",'all=Rifle'); mySelect.options[mySelect.options.length] = new Option("Silt schools",'all=Silt'); mySelect.options[mySelect.options.length] = new Option("Woody Creek schools",'all=Woody_Creek'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Parachute[Parachute.length] = createMarker(new GPoint(-108.08039856,39.50109863),"
Bea Underwood Elementary School
P O Box 68
Parachute, CO 81635

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Bea Underwood Elementary School",'Parachute=' + Parachute.length); Glenwood_Springs[Glenwood_Springs.length] = createMarker(new GPoint(-107.32498169,39.53928757),"
Bridges High School
504-a 27th Street
Glenwood Springs, CO 81601

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bridges High School",'Glenwood_Springs=' + Glenwood_Springs.length); Woody_Creek[Woody_Creek.length] = createMarker(new GPoint(-106.89530182,39.28129959),"
Carbondale Community Charter
P O Box 336
Woody Creek, CO 81656

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Carbondale Community Charter",'Woody_Creek=' + Woody_Creek.length); Carbondale[Carbondale.length] = createMarker(new GPoint(-107.21292114,39.40258026),"
Carbondale Community Charter School
P O Box 365
Carbondale, CO 81623

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Carbondale Community Charter School",'Carbondale=' + Carbondale.length); Carbondale[Carbondale.length] = createMarker(new GPoint(-107.20993042,39.39568710),"
Carbondale Elementary School
600 South 3rd
Carbondale, CO 81623

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Carbondale Elementary School",'Carbondale=' + Carbondale.length); Carbondale[Carbondale.length] = createMarker(new GPoint(-107.20993805,39.39637756),"
Carbondale Middle School
455 South 3rd
Carbondale, CO 81623

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Carbondale Middle School",'Carbondale=' + Carbondale.length); New_Castle[New_Castle.length] = createMarker(new GPoint(-107.65691400,39.54867200),"
Coal Ridge High School
35947 Highway 6 24
New Castle, CO 81647

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Coal Ridge High School",'New_Castle=' + New_Castle.length); Carbondale[Carbondale.length] = createMarker(new GPoint(-107.20655823,39.39856720),"
Crystal River Elementary School
160 Snowmass Drive
Carbondale, CO 81623

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Crystal River Elementary School",'Carbondale=' + Carbondale.length); Glenwood_Springs[Glenwood_Springs.length] = createMarker(new GPoint(-107.32740784,39.54523468),"
Glenwood Springs Elementary School
916 School Street
Glenwood Springs, CO 81602

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Glenwood Springs Elementary School",'Glenwood_Springs=' + Glenwood_Springs.length); Glenwood_Springs[Glenwood_Springs.length] = createMarker(new GPoint(-107.32700348,39.54009628),"
Glenwood Springs High School
1340 Pitkin Avenue
Glenwood Springs, CO 81602

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Glenwood Springs High School",'Glenwood_Springs=' + Glenwood_Springs.length); Glenwood_Springs[Glenwood_Springs.length] = createMarker(new GPoint(-107.35923767,39.56309891),"
Glenwood Springs Middle School
120 Soccerfield Road
Glenwood Springs, CO 81601

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Glenwood Springs Middle School",'Glenwood_Springs=' + Glenwood_Springs.length); Parachute[Parachute.length] = createMarker(new GPoint(-108.05352783,39.45279312),"
Grand Valley Early Childhood Literacy Center
Po Box 68
Parachute, CO 81635

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Grand Valley Early Childhood Literacy Center",'Parachute=' + Parachute.length); Parachute[Parachute.length] = createMarker(new GPoint(-108.08039856,39.50109863),"
Grand Valley High School
P O Box 68
Parachute, CO 81635

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Grand Valley High School",'Parachute=' + Parachute.length); Rifle[Rifle.length] = createMarker(new GPoint(-107.78357697,39.53551483),"
Highland Elementary School
1500 East 7th Street
Rifle, CO 81650

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Highland Elementary School",'Rifle=' + Rifle.length); New_Castle[New_Castle.length] = createMarker(new GPoint(-107.52469635,39.57640076),"
Kathryn Senor Elementary School
101 Alder Avenue
New Castle, CO 81647

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Kathryn Senor Elementary School",'New_Castle=' + New_Castle.length); Parachute[Parachute.length] = createMarker(new GPoint(-108.08039856,39.50109863),"
L W St John Middle School
P O Box 68
Parachute, CO 81635

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("L W St John Middle School",'Parachute=' + Parachute.length); Glenwood_Springs[Glenwood_Springs.length] = createMarker(new GPoint(-107.33397675,39.54782486),"
Mountain Boces Day Treatment Center
695 Red Mountain Drive
Glenwood Springs, CO 81601

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mountain Boces Day Treatment Center",'Glenwood_Springs=' + Glenwood_Springs.length); Rifle[Rifle.length] = createMarker(new GPoint(-107.79479980,39.54194260),"
Rifle High School
1350 Prefontaine Ave
Rifle, CO 81650

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Rifle High School",'Rifle=' + Rifle.length); Rifle[Rifle.length] = createMarker(new GPoint(-107.78389740,39.53453827),"
Rifle Middle School
200 West 6th
Rifle, CO 81650

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Rifle Middle School",'Rifle=' + Rifle.length); New_Castle[New_Castle.length] = createMarker(new GPoint(-107.52469635,39.57640076),"
Riverside School
804 West Main
New Castle, CO 81647

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Riverside School",'New_Castle=' + New_Castle.length); Carbondale[Carbondale.length] = createMarker(new GPoint(-107.20648193,39.39820480),"
Roaring Fork High School
180 Snowmass Drive
Carbondale, CO 81623

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Roaring Fork High School",'Carbondale=' + Carbondale.length); Carbondale[Carbondale.length] = createMarker(new GPoint(-107.21668500,39.39747800),"
Ross Montessori School
P O Box 1839
Carbondale, CO 81623

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Ross Montessori School",'Carbondale=' + Carbondale.length); Silt[Silt.length] = createMarker(new GPoint(-107.65070343,39.51950073),"
Roy Moore Elementary School
822 Orchard Avenue
Silt, CO 81652

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Roy Moore Elementary School",'Silt=' + Silt.length); Glenwood_Springs[Glenwood_Springs.length] = createMarker(new GPoint(-107.31551361,39.51033783),"
Sopris Elementary School
1150 Mount Sopris Drive
Glenwood Springs, CO 81602

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Sopris Elementary School",'Glenwood_Springs=' + Glenwood_Springs.length); Rifle[Rifle.length] = createMarker(new GPoint(-107.77436829,39.55571365),"
Wamsley Elementary School
225 East 30th Street
Rifle, CO 81650

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Wamsley Elementary School",'Rifle=' + Rifle.length); Glenwood_Springs[Glenwood_Springs.length] = createMarker(new GPoint(-107.33397675,39.54782486),"
Yampah Mountain School
695 Red Mountain Drive
Glenwood Springs, CO 81601

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Yampah Mountain School",'Glenwood_Springs=' + Glenwood_Springs.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,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(Carbondale); map.removeOverlays(Glenwood_Springs); map.removeOverlays(New_Castle); map.removeOverlays(Parachute); map.removeOverlays(Rifle); map.removeOverlays(Silt); map.removeOverlays(Woody_Creek); 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(Parachute);map.removeOverlays(Carbondale); map.removeOverlays(Glenwood_Springs); map.removeOverlays(New_Castle); map.removeOverlays(Parachute); map.removeOverlays(Rifle); map.removeOverlays(Silt); map.removeOverlays(Woody_Creek); map.addOverlays(Carbondale); centerByArray(Carbondale, false, false); cntMarker += Carbondale.length; map.addOverlays(Glenwood_Springs); centerByArray(Glenwood_Springs, false, false); cntMarker += Glenwood_Springs.length; map.addOverlays(New_Castle); centerByArray(New_Castle, false, false); cntMarker += New_Castle.length; map.addOverlays(Parachute); centerByArray(Parachute, false, false); cntMarker += Parachute.length; map.addOverlays(Rifle); centerByArray(Rifle, false, false); cntMarker += Rifle.length; map.addOverlays(Silt); centerByArray(Silt, false, false); cntMarker += Silt.length; map.addOverlays(Woody_Creek); centerByArray(Woody_Creek, false, false); cntMarker += Woody_Creek.length; centerByArray(Parachute,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'); } }