function addMarkers(){ mySelect = document.getElementById('selection'); Pearl_City = [];Kahului = [];Honolulu = [];Kamuela = [];Kaneohe = [];mySelect.options[mySelect.options.length] = new Option("Honolulu schools",'all=Honolulu'); mySelect.options[mySelect.options.length] = new Option("Kahului schools",'all=Kahului'); mySelect.options[mySelect.options.length] = new Option("Kamuela schools",'all=Kamuela'); mySelect.options[mySelect.options.length] = new Option("Kaneohe schools",'all=Kaneohe'); mySelect.options[mySelect.options.length] = new Option("Pearl City schools",'all=Pearl_City'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); 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); 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); Honolulu[Honolulu.length] = createMarker(new GPoint(-157.90253800,21.36516200),"
Christian Academy
3400 Moanalua Rd
Honolulu, HI 96819
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Christian Academy",'Honolulu=' + Honolulu.length); Kamuela[Kamuela.length] = createMarker(new GPoint(-155.70078400,20.02930500),"
Hawaii Preparatory Academy
65-1692 Kohala Mountain Rd
Kamuela, HI 96743
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Hawaii Preparatory Academy",'Kamuela=' + Kamuela.length); Honolulu[Honolulu.length] = createMarker(new GPoint(-157.93049100,21.33792500),"
Holy Family Catholic Academy
830 Main Street
Honolulu, HI 96818
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Holy Family Catholic Academy",'Honolulu=' + Honolulu.length); Honolulu[Honolulu.length] = createMarker(new GPoint(-157.73464500,21.28576300),"
Honolulu Waldorf School
350 Ulua Street
Honolulu, HI 96821
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Honolulu Waldorf School",'Honolulu=' + Honolulu.length); Honolulu[Honolulu.length] = createMarker(new GPoint(-157.83497800,21.30612200),"
Playmate Kindergarten, Day Car
1704 Keeaumoku Street
Honolulu, HI 96822
Co-ed school, PK-3
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Playmate Kindergarten, Day Car",'Honolulu=' + Honolulu.length); Honolulu[Honolulu.length] = createMarker(new GPoint(-157.85644500,21.31025500),"
St. Andrews Priory School
224 Queen Emma Square
Honolulu, HI 96813
All-girls school, K-12
[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("St. Andrews Priory School",'Honolulu=' + Honolulu.length); Honolulu[Honolulu.length] = createMarker(new GPoint(-157.86101400,21.32371200),"
St. Theresa Catholic School
712 N School Street
Honolulu, HI 96817
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Theresa Catholic School",'Honolulu=' + Honolulu.length); Honolulu[Honolulu.length] = createMarker(new GPoint(-157.82500000,21.29160000),"
Varsity International School
2617 South King St., 3-d
Honolulu, HI 96826
Co-ed school, 7-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Varsity International School",'Honolulu=' + Honolulu.length); Kaneohe[Kaneohe.length] = createMarker(new GPoint(-157.80648100,21.41791300),"
Windward Nazarene Academy
45-232 Puaae Rd Pob 1633
Kaneohe, HI 96744
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Windward Nazarene Academy",'Kaneohe=' + Kaneohe.length); map.removeOverlays(Honolulu); map.removeOverlays(Kahului); map.removeOverlays(Kamuela); map.removeOverlays(Kaneohe); map.removeOverlays(Pearl_City); setTimeout(function(){map.addOverlays(Honolulu)},1000); setTimeout(function(){map.addOverlays(Kahului)},1000); setTimeout(function(){map.addOverlays(Kamuela)},1000); setTimeout(function(){map.addOverlays(Kaneohe)},1000); setTimeout(function(){map.addOverlays(Pearl_City)},1000); maxLng = -155.70078400; maxLat = 21.41791300; minLng = -157.96152600; minLat = 20.02930500; 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(Kahului); map.removeOverlays(Kamuela); map.removeOverlays(Kaneohe); 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(Pearl_City);map.removeOverlays(Honolulu); map.removeOverlays(Kahului); map.removeOverlays(Kamuela); map.removeOverlays(Kaneohe); map.removeOverlays(Pearl_City); map.addOverlays(Honolulu); centerByArray(Honolulu, false, false); cntMarker += Honolulu.length; map.addOverlays(Kahului); centerByArray(Kahului, false, false); cntMarker += Kahului.length; map.addOverlays(Kamuela); centerByArray(Kamuela, false, false); cntMarker += Kamuela.length; map.addOverlays(Kaneohe); centerByArray(Kaneohe, false, false); cntMarker += Kaneohe.length; map.addOverlays(Pearl_City); centerByArray(Pearl_City, false, false); cntMarker += Pearl_City.length; centerByArray(Pearl_City,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///8087,8113,8177,8207,8104,8087,8109,8113,8167,8177,8197,8086,8104,8212,8085,/all'); //window.open('/map.php?type=2&schools=8087,8113,8177,8207,8104,8087,8109,8113,8167,8177,8197,8086,8104,8212,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; }