function addMarkers(){ mySelect = document.getElementById('selection'); Honolulu = [];Hilo = [];Lihue = [];Pearl_City = [];Kahului = [];Kaneohe = [];mySelect.options[mySelect.options.length] = new Option("Hilo Schools",'all=Hilo'); 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("Kaneohe Schools",'all=Kaneohe'); mySelect.options[mySelect.options.length] = new Option("Lihue Schools",'all=Lihue'); mySelect.options[mySelect.options.length] = new Option("Pearl City Schools",'all=Pearl_City'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); var tmpLatLng=0; var tmpLen=0; tmpLatLng=new GLatLng(21.31012700000000137,-157.862782000000009); tmpLen=Honolulu.length; Honolulu[tmpLen] = createMarker(tmpLatLng,"
Hawaii Business College
33 S King St, 4th Floor
Honolulu, HI 96813

[ View School Profile ]
",iconGr); Honolulu[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Hawaii Business College",'Honolulu=' + Honolulu.length); tmpLatLng=new GLatLng(19.70482300000000108,-155.078696000000007); tmpLen=Hilo.length; Hilo[tmpLen] = createMarker(tmpLatLng,"
Hawaii Community College
200 W Kawili St
Hilo, HI 96720

[ View School Profile ]
",iconGr); Hilo[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Hawaii Community College",'Hilo=' + Hilo.length); tmpLatLng=new GLatLng(21.29579499999999825,-157.844255000000003); tmpLen=Honolulu.length; Honolulu[tmpLen] = createMarker(tmpLatLng,"
Heald College-honolulu
1500 Kapiolani Blvd
Honolulu, HI 96814

[ View School Profile ]
",iconRd); Honolulu[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Heald College-honolulu",'Honolulu=' + Honolulu.length); tmpLatLng=new GLatLng(21.32322699999999926,-157.872253000000000); tmpLen=Honolulu.length; Honolulu[tmpLen] = createMarker(tmpLatLng,"
Honolulu Community College
874 Dillingham Blvd
Honolulu, HI 96817

[ View School Profile ]
",iconGr); Honolulu[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Honolulu Community College",'Honolulu=' + Honolulu.length); tmpLatLng=new GLatLng(21.27226800000000039,-157.804924999999997); tmpLen=Honolulu.length; Honolulu[tmpLen] = createMarker(tmpLatLng,"
Kapiolani Community College
4303 Diamond Head Rd
Honolulu, HI 96816

[ View School Profile ]
",iconGr); Honolulu[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Kapiolani Community College",'Honolulu=' + Honolulu.length); tmpLatLng=new GLatLng(21.96992699999999842,-159.398215999999990); tmpLen=Lihue.length; Lihue[tmpLen] = createMarker(tmpLatLng,"
Kauai Community College
3-1901 Kaumualii Hwy
Lihue, HI 96766

[ View School Profile ]
",iconGr); Lihue[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Kauai Community College",'Lihue=' + Lihue.length); tmpLatLng=new GLatLng(21.39721099999999864,-157.987988999999998); tmpLen=Pearl_City.length; Pearl_City[tmpLen] = createMarker(tmpLatLng,"
Leeward Community College
96-045 Ala Ike
Pearl City, HI 96782

[ View School Profile ]
",iconGr); Pearl_City[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Leeward Community College",'Pearl_City=' + Pearl_City.length); tmpLatLng=new GLatLng(20.89209599999999866,-156.478940999999991); tmpLen=Kahului.length; Kahului[tmpLen] = createMarker(tmpLatLng,"
Maui Community College
310 Kaahumanu Ave
Kahului, HI 96732

[ View School Profile ]
",iconGr); Kahului[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Maui Community College",'Kahului=' + Kahului.length); tmpLatLng=new GLatLng(21.41301699999999996,-157.812261000000006); tmpLen=Kaneohe.length; Kaneohe[tmpLen] = createMarker(tmpLatLng,"
Windward Community College
45-720 Keaahala Rd
Kaneohe, HI 96744

[ View School Profile ]
",iconGr); Kaneohe[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Windward Community College",'Kaneohe=' + Kaneohe.length); map.removeOverlays(Hilo); map.removeOverlays(Honolulu); map.removeOverlays(Kahului); map.removeOverlays(Kaneohe); map.removeOverlays(Lihue); map.removeOverlays(Pearl_City); setTimeout(function(){map.addOverlays(Hilo)},1000); setTimeout(function(){map.addOverlays(Honolulu)},1000); setTimeout(function(){map.addOverlays(Kahului)},1000); setTimeout(function(){map.addOverlays(Kaneohe)},1000); setTimeout(function(){map.addOverlays(Lihue)},1000); setTimeout(function(){map.addOverlays(Pearl_City)},1000); getPoly("","state","","HI");} // End addStateMarkers JavaScript Function //open all when map is defined function openAll() { if (map) { selectChange("all"); } else { setTimeout("openAll()",200); } } // 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].point.x; var markLat = myArray[i].point.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].point.x; maxLat = myArray[0].point.y; minLng = myArray[0].point.x; minLat = myArray[0].point.y; } // Recenter map based on global max/mins function reCenterMap(){ //alert('#' + minLat + '#' + minLng + '#' + maxLat + '#' + maxLng); 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) { if (selection.options) { var _openNewWindow=true; var myVal = selection.options[selection.selectedIndex].value; } else { var _openNewWindow=false; var myVal=selection; } 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('schools-by-distance') == -1) window.open(location.href + '/map/all'); else window.open('/search////all'); map.removeOverlays(Hilo); map.removeOverlays(Honolulu); map.removeOverlays(Kahului); map.removeOverlays(Kaneohe); map.removeOverlays(Lihue); 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(Hilo); map.removeOverlays(Honolulu); map.removeOverlays(Kahului); map.removeOverlays(Kaneohe); map.removeOverlays(Lihue); map.removeOverlays(Pearl_City); map.addOverlays(Hilo); centerByArray(Hilo, false, false); cntMarker += Hilo.length; map.addOverlays(Honolulu); centerByArray(Honolulu, false, false); cntMarker += Honolulu.length; map.addOverlays(Kahului); centerByArray(Kahului, false, false); cntMarker += Kahului.length; map.addOverlays(Kaneohe); centerByArray(Kaneohe, false, false); cntMarker += Kaneohe.length; map.addOverlays(Lihue); centerByArray(Lihue, false, false); cntMarker += Lihue.length; map.addOverlays(Pearl_City); centerByArray(Pearl_City, false, false); cntMarker += Pearl_City.length; reCenterMap(); //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'); } } function createMarker(point, label, icon){ var marker = new GMarker(point, icon); var html = label; GEvent.addListener(marker, "click", function() { marker.openInfoWindowHtml(html); }); return marker; }