function addMarkers(){ mySelect = document.getElementById('selection'); Honolulu = [];Pearl_City = [];Kailua_Kona = [];Kamuela = [];Pahoa = [];Kihei = [];Makawao = [];Mililani = [];mySelect.options[mySelect.options.length] = new Option("Honolulu schools",'all=Honolulu'); mySelect.options[mySelect.options.length] = new Option("Kailua Kona schools",'all=Kailua_Kona'); mySelect.options[mySelect.options.length] = new Option("Kamuela schools",'all=Kamuela'); mySelect.options[mySelect.options.length] = new Option("Kihei schools",'all=Kihei'); mySelect.options[mySelect.options.length] = new Option("Makawao schools",'all=Makawao'); mySelect.options[mySelect.options.length] = new Option("Mililani schools",'all=Mililani'); mySelect.options[mySelect.options.length] = new Option("Pahoa schools",'all=Pahoa'); mySelect.options[mySelect.options.length] = new Option("Pearl City schools",'all=Pearl_City'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Honolulu[Honolulu.length] = createMarker(new GPoint(-157.74973100,21.27840800),"
Calvary By The Sea Montessori School
5339 Kalanianaole Hwy
Honolulu, HI 96821
Co-ed school, NS-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Calvary By The Sea Montessori School",'Honolulu=' + Honolulu.length); Pearl_City[Pearl_City.length] = createMarker(new GPoint(-157.96152600,21.41569100),"
The Children's House
1840 Komo Mai Drive
Pearl City, HI 96782
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The Children's House",'Pearl_City=' + Pearl_City.length); Kailua_Kona[Kailua_Kona.length] = createMarker(new GPoint(-155.98591700,19.67513800),"
Hawaii Montessori School At Kona
74-978 Manawalea Street
Kailua Kona, HI 96740
Co-ed school, PK-1
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Hawaii Montessori School At Kona",'Kailua_Kona=' + Kailua_Kona.length); Kamuela[Kamuela.length] = createMarker(new GPoint(-155.66049000,20.02504600),"
Hawai'i Montessori Schools - Kamuela
64-1058 Mamalahoa Highway 201
Kamuela, HI 96743
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Hawai'i Montessori Schools - Kamuela",'Kamuela=' + Kamuela.length); Honolulu[Honolulu.length] = createMarker(new GPoint(-157.85780300,21.30339600),"
Kawaiaha'o Church School
872 Mission Lane
Honolulu, HI 96813
Co-ed school, NS-5
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Kawaiaha'o Church School",'Honolulu=' + Honolulu.length); Honolulu[Honolulu.length] = createMarker(new GPoint(-157.80898900,21.28800100),"
L Robert Allen Montessori
3140 Waialae Avenue
Honolulu, HI 96816
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("L Robert Allen Montessori",'Honolulu=' + Honolulu.length); Honolulu[Honolulu.length] = createMarker(new GPoint(-157.84125300,21.30484800),"
Lokahi Montessori School
1506 Piikoi Street
Honolulu, HI 96822
Co-ed school, PK-1
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Lokahi Montessori School",'Honolulu=' + Honolulu.length); Honolulu[Honolulu.length] = createMarker(new GPoint(-157.83624800,21.30865900),"
Montessori Community School
1239 Nehoa St
Honolulu, HI 96822
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Montessori Community School",'Honolulu=' + Honolulu.length); Pahoa[Pahoa.length] = createMarker(new GPoint(-154.92220000,19.47960000),"
Montessori Country School
Po Box 1203 15-3006 Puna Road
Pahoa, HI 96778
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Montessori Country School",'Pahoa=' + Pahoa.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); Mililani[Mililani.length] = createMarker(new GPoint(-158.01452300,21.45799900),"
St. John's Catholic Preschool
95-370 Kuahelani Avenue
Mililani, HI 96789
Co-ed school, NS-PK
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. John's Catholic Preschool",'Mililani=' + Mililani.length); Honolulu[Honolulu.length] = createMarker(new GPoint(-157.91402700,21.34671900),"
St. Philomena Early Learning Center
3300 Ala Laulani St
Honolulu, HI 96818
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Philomena Early Learning Center",'Honolulu=' + Honolulu.length); Honolulu[Honolulu.length] = createMarker(new GPoint(-157.92888000,21.33892000),"
Star Of The Sea Early Learning Center
4470 Aliikoa Street Suite 100
Honolulu, HI 96821
Co-ed school, K-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Star Of The Sea Early Learning Center",'Honolulu=' + Honolulu.length); Kailua_Kona[Kailua_Kona.length] = createMarker(new GPoint(-155.98647400,19.63104000),"
University Of The Nations Preschool
75-5851 Kuakini Highway 228
Kailua Kona, HI 96740
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("University Of The Nations Preschool",'Kailua_Kona=' + Kailua_Kona.length); Kamuela[Kamuela.length] = createMarker(new GPoint(-155.70020000,19.96150000),"
Waimea Community Montessori School
Po Box 967
Kamuela, HI 96743
Co-ed school, PK-KG
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Waimea Community Montessori School",'Kamuela=' + Kamuela.length); map.removeOverlays(Honolulu); map.removeOverlays(Kailua_Kona); map.removeOverlays(Kamuela); map.removeOverlays(Kihei); map.removeOverlays(Makawao); map.removeOverlays(Mililani); map.removeOverlays(Pahoa); map.removeOverlays(Pearl_City); setTimeout(function(){map.addOverlays(Honolulu)},1000); setTimeout(function(){map.addOverlays(Kailua_Kona)},1000); setTimeout(function(){map.addOverlays(Kamuela)},1000); setTimeout(function(){map.addOverlays(Kihei)},1000); setTimeout(function(){map.addOverlays(Makawao)},1000); setTimeout(function(){map.addOverlays(Mililani)},1000); setTimeout(function(){map.addOverlays(Pahoa)},1000); setTimeout(function(){map.addOverlays(Pearl_City)},1000); maxLng = -154.92220000; maxLat = 21.45799900; minLng = -158.01452300; minLat = 19.47960000; reCenterMap(); } // 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//////' + showArray); map.removeOverlays(Honolulu); map.removeOverlays(Kailua_Kona); map.removeOverlays(Kamuela); map.removeOverlays(Kihei); map.removeOverlays(Makawao); map.removeOverlays(Mililani); map.removeOverlays(Pahoa); map.removeOverlays(Pearl_City); 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(Honolulu);map.removeOverlays(Honolulu); map.removeOverlays(Kailua_Kona); map.removeOverlays(Kamuela); map.removeOverlays(Kihei); map.removeOverlays(Makawao); map.removeOverlays(Mililani); map.removeOverlays(Pahoa); map.removeOverlays(Pearl_City); map.addOverlays(Honolulu); centerByArray(Honolulu, false, false); cntMarker += Honolulu.length; map.addOverlays(Kailua_Kona); centerByArray(Kailua_Kona, false, false); cntMarker += Kailua_Kona.length; map.addOverlays(Kamuela); centerByArray(Kamuela, false, false); cntMarker += Kamuela.length; map.addOverlays(Kihei); centerByArray(Kihei, false, false); cntMarker += Kihei.length; map.addOverlays(Makawao); centerByArray(Makawao, false, false); cntMarker += Makawao.length; map.addOverlays(Mililani); centerByArray(Mililani, false, false); cntMarker += Mililani.length; map.addOverlays(Pahoa); centerByArray(Pahoa, false, false); cntMarker += Pahoa.length; map.addOverlays(Pearl_City); centerByArray(Pearl_City, false, false); cntMarker += Pearl_City.length; centerByArray(Honolulu,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///8082,8126,8134,8140,8155,8196,8200,34560,34748,34747,8209,8157,8158,8188,8156,8085,/all'); //window.open('/map.php?type=2&schools=8082,8126,8134,8140,8155,8196,8200,34560,34748,34747,8209,8157,8158,8188,8156,8085,&school_level=&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; }