function addMarkers(){ mySelect = document.getElementById('selection'); Kahului = [];Kula = [];Paia = [];Haiku = [];Makawao = [];Hoolehua = [];Kaunakakai = [];Kihei = [];Lahaina = [];Wailuku = [];mySelect.options[mySelect.options.length] = new Option("Haiku schools",'all=Haiku'); mySelect.options[mySelect.options.length] = new Option("Hoolehua schools",'all=Hoolehua'); mySelect.options[mySelect.options.length] = new Option("Kahului schools",'all=Kahului'); mySelect.options[mySelect.options.length] = new Option("Kaunakakai schools",'all=Kaunakakai'); mySelect.options[mySelect.options.length] = new Option("Kihei schools",'all=Kihei'); mySelect.options[mySelect.options.length] = new Option("Kula schools",'all=Kula'); mySelect.options[mySelect.options.length] = new Option("Lahaina schools",'all=Lahaina'); mySelect.options[mySelect.options.length] = new Option("Makawao schools",'all=Makawao'); mySelect.options[mySelect.options.length] = new Option("Paia schools",'all=Paia'); mySelect.options[mySelect.options.length] = new Option("Wailuku schools",'all=Wailuku'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Kahului[Kahului.length] = createMarker(new GPoint(-156.46640200,20.88494600),"
Christ The King School
211 Kaulawahine St
Kahului, HI 96732
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Christ The King School",'Kahului=' + Kahului.length); Kula[Kula.length] = createMarker(new GPoint(-156.32680000,20.74130000),"
Clearview Christian Girl School
Po Box 835
Kula, HI 96790
All-girls school, 6-9
[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Clearview Christian Girl School",'Kula=' + Kula.length); Paia[Paia.length] = createMarker(new GPoint(-156.37179000,20.90329500),"
Doris Todd Memorial Christian School
519 Baldwin Avenue
Paia, HI 96779
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Doris Todd Memorial Christian School",'Paia=' + Paia.length); Kahului[Kahului.length] = createMarker(new GPoint(-156.48223700,20.88834100),"
Emmanuel Lutheran School
520 One Street
Kahului, HI 96732
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Emmanuel Lutheran School",'Kahului=' + Kahului.length); Kula[Kula.length] = createMarker(new GPoint(-156.32595600,20.76606900),"
Haleakala Waldorf School
4160 Lower Kula Road
Kula, HI 96790
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Haleakala Waldorf School",'Kula=' + Kula.length); Haiku[Haiku.length] = createMarker(new GPoint(-156.28440000,20.90490000),"
Horizons Academy Of Maul Inc
Po Box 1308 740 Haiku Road
Haiku, HI 96708
Co-ed school, 5-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Horizons Academy Of Maul Inc",'Haiku=' + Haiku.length); Kahului[Kahului.length] = createMarker(new GPoint(-156.45904400,20.87411400),"
Ka'ahumanu Hou Christian School
777 Mokulele Hwy
Kahului, HI 96732
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Ka'ahumanu Hou Christian School",'Kahului=' + Kahului.length); Makawao[Makawao.length] = createMarker(new GPoint(-156.33558700,20.82285700),"
Kamehameha Schools Maui Campus
275 Aapueo Parkway
Makawao, HI 96768
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Kamehameha Schools Maui Campus",'Makawao=' + Makawao.length); Kahului[Kahului.length] = createMarker(new GPoint(-156.46435000,20.88512800),"
Maui Adventist School
261 S Puunene Avenue
Kahului, HI 96732
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Maui Adventist School",'Kahului=' + Kahului.length); Hoolehua[Hoolehua.length] = createMarker(new GPoint(-157.09150000,21.16210000),"
Molokai Christian Academy
Pob 555
Hoolehua, HI 96729
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Molokai Christian Academy",'Hoolehua=' + Hoolehua.length); Kaunakakai[Kaunakakai.length] = createMarker(new GPoint(-156.98610000,21.08940000),"
Molokai Mission School
Po Box 482271
Kaunakakai, HI 96748
Co-ed school, 5-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Molokai Mission School",'Kaunakakai=' + Kaunakakai.length); Kihei[Kihei.length] = createMarker(new GPoint(-156.44640000,20.73080000),"
Montessori Hale O Keiki Inc
Po Box 2348
Kihei, HI 96753
Co-ed school, PK-5
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Montessori Hale O Keiki Inc",'Kihei=' + Kihei.length); Makawao[Makawao.length] = createMarker(new GPoint(-156.32263400,20.86950300),"
Montessori School Of Maui
2933 Baldwin Avenue
Makawao, HI 96768
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Montessori School Of Maui",'Makawao=' + Makawao.length); Lahaina[Lahaina.length] = createMarker(new GPoint(-156.67599300,20.87548000),"
Sacred Hearts School And Early Learning Center
239 Dickenson Street
Lahaina, HI 96761
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Sacred Hearts School And Early Learning Center",'Lahaina=' + Lahaina.length); Wailuku[Wailuku.length] = createMarker(new GPoint(-156.49572600,20.89197000),"
St. Anthony Jr/sr High School
1618 Lower Main Street
Wailuku, HI 96793
Co-ed school, 7-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Anthony Jr/sr High School",'Wailuku=' + Wailuku.length); Makawao[Makawao.length] = createMarker(new GPoint(-156.30844800,20.85635000),"
St. Joseph School
1294 Makawao Avenue
Makawao, HI 96768
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Joseph School",'Makawao=' + Makawao.length); Makawao[Makawao.length] = createMarker(new GPoint(-156.30882300,20.84088100),"
Seabury Hall
480 Olinda Road
Makawao, HI 96768
Co-ed school, 6-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Seabury Hall",'Makawao=' + Makawao.length); Wailuku[Wailuku.length] = createMarker(new GPoint(-156.50620000,20.88820000),"
St Anthony Grade School
1627a Mill Street
Wailuku, HI 96793
Co-ed school, K-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Anthony Grade School",'Wailuku=' + Wailuku.length); Kahului[Kahului.length] = createMarker(new GPoint(-156.48242600,20.89921900),"
Victory Christian Academy
420 N Wakea Ave
Kahului, HI 96732
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Victory Christian Academy",'Kahului=' + Kahului.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,11); /* 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/////3/' + showArray); map.removeOverlays(Haiku); map.removeOverlays(Hoolehua); map.removeOverlays(Kahului); map.removeOverlays(Kaunakakai); map.removeOverlays(Kihei); map.removeOverlays(Kula); map.removeOverlays(Lahaina); map.removeOverlays(Makawao); map.removeOverlays(Paia); map.removeOverlays(Wailuku); 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(Kahului);map.removeOverlays(Haiku); map.removeOverlays(Hoolehua); map.removeOverlays(Kahului); map.removeOverlays(Kaunakakai); map.removeOverlays(Kihei); map.removeOverlays(Kula); map.removeOverlays(Lahaina); map.removeOverlays(Makawao); map.removeOverlays(Paia); map.removeOverlays(Wailuku); map.addOverlays(Haiku); centerByArray(Haiku, false, false); cntMarker += Haiku.length; map.addOverlays(Hoolehua); centerByArray(Hoolehua, false, false); cntMarker += Hoolehua.length; map.addOverlays(Kahului); centerByArray(Kahului, false, false); cntMarker += Kahului.length; map.addOverlays(Kaunakakai); centerByArray(Kaunakakai, false, false); cntMarker += Kaunakakai.length; map.addOverlays(Kihei); centerByArray(Kihei, false, false); cntMarker += Kihei.length; map.addOverlays(Kula); centerByArray(Kula, false, false); cntMarker += Kula.length; map.addOverlays(Lahaina); centerByArray(Lahaina, false, false); cntMarker += Lahaina.length; map.addOverlays(Makawao); centerByArray(Makawao, false, false); cntMarker += Makawao.length; map.addOverlays(Paia); centerByArray(Paia, false, false); cntMarker += Paia.length; map.addOverlays(Wailuku); centerByArray(Wailuku, false, false); cntMarker += Wailuku.length; centerByArray(Kahului,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'); //window.open('/map.php?type=1&schools=&school_level=3&radius=&zipcode=&school_type_search=&school_type_code='); } } function createMarker(point, label, icon) { var marker = new GMarker(point, icon); var html = label; GEvent.addListener(marker, "click", function() { marker.openInfoWindowHtml(html); }); return marker; }