function addMarkers() { mySelect = document.getElementById('selection'); Nome = [];Bethel = [];Fairbanks = [];Anchorage = [];Homer = [];Juneau = [];Galena = [];Soldotna = [];mySelect.options[mySelect.options.length] = new Option("Anchorage magnet schools",'all=Anchorage'); mySelect.options[mySelect.options.length] = new Option("Bethel magnet schools",'all=Bethel'); mySelect.options[mySelect.options.length] = new Option("Fairbanks magnet schools",'all=Fairbanks'); mySelect.options[mySelect.options.length] = new Option("Galena magnet schools",'all=Galena'); mySelect.options[mySelect.options.length] = new Option("Homer magnet schools",'all=Homer'); mySelect.options[mySelect.options.length] = new Option("Juneau magnet schools",'all=Juneau'); mySelect.options[mySelect.options.length] = new Option("Nome magnet schools",'all=Nome'); mySelect.options[mySelect.options.length] = new Option("Soldotna magnet schools",'all=Soldotna'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Nome[Nome.length] = createMarker(new GPoint(-165.27229309,64.78730011),"
Anvil City Science Academy
Po Box 1147
Nome, AK 99762

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Anvil City Science Academy",'Nome=' + Nome.length); Bethel[Bethel.length] = createMarker(new GPoint(-161.41059875,60.85309982),"
Ayaprun Elitnaurvik Yup’ik Immersion Elementary School
Po Box 1468
Bethel, AK 99559

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Ayaprun Elitnaurvik Yup’ik Immersion Elementary School",'Bethel=' + Bethel.length); Fairbanks[Fairbanks.length] = createMarker(new GPoint(-147.72663879,64.83905792),"
Barnette Elementary School
1000 Barnette Street
Fairbanks, AK 99701

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Barnette Elementary School",'Fairbanks=' + Fairbanks.length); Anchorage[Anchorage.length] = createMarker(new GPoint(-149.89144900,61.20864900),"
Central Middle School Of Science
1405 E St
Anchorage, AK 99501

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Central Middle School Of Science",'Anchorage=' + Anchorage.length); Fairbanks[Fairbanks.length] = createMarker(new GPoint(-147.75025940,64.81832886),"
Chinook Charter School
3002 International Street
Fairbanks, AK 99701

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Chinook Charter School",'Fairbanks=' + Fairbanks.length); Anchorage[Anchorage.length] = createMarker(new GPoint(-149.89144900,61.21062500),"
Chugach Optional Elementary School
1205 E St.
Anchorage, AK 99501

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Chugach Optional Elementary School",'Anchorage=' + Anchorage.length); Homer[Homer.length] = createMarker(new GPoint(-151.49360657,59.64350128),"
Fireweed Academy
Po Box 474
Homer, AK 99603

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Fireweed Academy",'Homer=' + Homer.length); Anchorage[Anchorage.length] = createMarker(new GPoint(-149.87373352,61.23104477),"
Government Hill Elementary School
525 Bluff Drive
Anchorage, AK 99501

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Government Hill Elementary School",'Anchorage=' + Anchorage.length); Anchorage[Anchorage.length] = createMarker(new GPoint(-149.81750488,61.10260010),"
Highland Tech. Charter School
5530 East Northern Lights Suit
Anchorage, AK 99504

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Highland Tech. Charter School",'Anchorage=' + Anchorage.length); Fairbanks[Fairbanks.length] = createMarker(new GPoint(-147.91566467,64.91491699),"
Hutchison Career Center
3750 Geist Road
Fairbanks, AK 99709

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Hutchison Career Center",'Fairbanks=' + Fairbanks.length); Juneau[Juneau.length] = createMarker(new GPoint(-134.40734863,58.30223846),"
Juneau Community Charter School
10014 Crazy Horse Dr
Juneau, AK 99801

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Juneau Community Charter School",'Juneau=' + Juneau.length); Anchorage[Anchorage.length] = createMarker(new GPoint(-149.83032227,61.19504166),"
King Career Center
2650 E Northern Lights Blvd.
Anchorage, AK 99508

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("King Career Center",'Anchorage=' + Anchorage.length); Anchorage[Anchorage.length] = createMarker(new GPoint(-149.83787537,61.16624832),"
Northern Lights Abc K-8 School
2424 East Dowling Road
Anchorage, AK 99507

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Northern Lights Abc K-8 School",'Anchorage=' + Anchorage.length); Anchorage[Anchorage.length] = createMarker(new GPoint(-149.85604858,61.16626358),"
Polaris K-12 School
1444 E. Dowling Road
Anchorage, AK 99507

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Polaris K-12 School",'Anchorage=' + Anchorage.length); Galena[Galena.length] = createMarker(new GPoint(-154.66740417,65.75450134),"
Project Education Residential School
Po Box 359
Galena, AK 99741

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Project Education Residential School",'Galena=' + Galena.length); Soldotna[Soldotna.length] = createMarker(new GPoint(-151.07687378,60.49023819),"
Soldotna Montessori Charter School
162 Park Street
Soldotna, AK 99669

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Soldotna Montessori Charter School",'Soldotna=' + Soldotna.length); Anchorage[Anchorage.length] = createMarker(new GPoint(-149.89288330,61.19784164),"
Steller Secondary School
2508 Blueberry Lane
Anchorage, AK 99503

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Steller Secondary School",'Anchorage=' + Anchorage.length); Anchorage[Anchorage.length] = createMarker(new GPoint(-149.93362427,61.18965149),"
Village Charter School
3020 Minnesota Drive Suite 8f
Anchorage, AK 99517

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Village Charter School",'Anchorage=' + Anchorage.length); maxLng = -134.40734863; maxLat = 65.75450134; minLng = -165.27229309; minLat = 58.30223846; reCenterMap(); map.removeOverlays(Anchorage); map.removeOverlays(Bethel); map.removeOverlays(Fairbanks); map.removeOverlays(Galena); map.removeOverlays(Homer); map.removeOverlays(Juneau); map.removeOverlays(Nome); map.removeOverlays(Soldotna); setTimeout(function(){map.addOverlays(Anchorage)},1000); setTimeout(function(){map.addOverlays(Bethel)},1000); setTimeout(function(){map.addOverlays(Fairbanks)},1000); setTimeout(function(){map.addOverlays(Galena)},1000); setTimeout(function(){map.addOverlays(Homer)},1000); setTimeout(function(){map.addOverlays(Juneau)},1000); setTimeout(function(){map.addOverlays(Nome)},1000); setTimeout(function(){map.addOverlays(Soldotna)},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(Anchorage); map.removeOverlays(Bethel); map.removeOverlays(Fairbanks); map.removeOverlays(Galena); map.removeOverlays(Homer); map.removeOverlays(Juneau); map.removeOverlays(Nome); map.removeOverlays(Soldotna); 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(Nome);map.removeOverlays(Anchorage); map.removeOverlays(Bethel); map.removeOverlays(Fairbanks); map.removeOverlays(Galena); map.removeOverlays(Homer); map.removeOverlays(Juneau); map.removeOverlays(Nome); map.removeOverlays(Soldotna); map.addOverlays(Anchorage); centerByArray(Anchorage, false, false); cntMarker += Anchorage.length; map.addOverlays(Bethel); centerByArray(Bethel, false, false); cntMarker += Bethel.length; map.addOverlays(Fairbanks); centerByArray(Fairbanks, false, false); cntMarker += Fairbanks.length; map.addOverlays(Galena); centerByArray(Galena, false, false); cntMarker += Galena.length; map.addOverlays(Homer); centerByArray(Homer, false, false); cntMarker += Homer.length; map.addOverlays(Juneau); centerByArray(Juneau, false, false); cntMarker += Juneau.length; map.addOverlays(Nome); centerByArray(Nome, false, false); cntMarker += Nome.length; map.addOverlays(Soldotna); centerByArray(Soldotna, false, false); cntMarker += Soldotna.length; centerByArray(Nome,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'); } }