function addMarkers() { mySelect = document.getElementById('selection'); Meridian = [];Burley = [];Greenleaf = [];Boise = [];Idaho_Falls = [];Pocatello = [];Nampa = [];Twin_Falls = [];Cottonwood = [];Post_Falls = [];mySelect.options[mySelect.options.length] = new Option("Boise vocational schools",'all=Boise'); mySelect.options[mySelect.options.length] = new Option("Burley vocational schools",'all=Burley'); mySelect.options[mySelect.options.length] = new Option("Cottonwood vocational schools",'all=Cottonwood'); mySelect.options[mySelect.options.length] = new Option("Greenleaf vocational schools",'all=Greenleaf'); mySelect.options[mySelect.options.length] = new Option("Idaho Falls vocational schools",'all=Idaho_Falls'); mySelect.options[mySelect.options.length] = new Option("Meridian vocational schools",'all=Meridian'); mySelect.options[mySelect.options.length] = new Option("Nampa vocational schools",'all=Nampa'); mySelect.options[mySelect.options.length] = new Option("Pocatello vocational schools",'all=Pocatello'); mySelect.options[mySelect.options.length] = new Option("Post Falls vocational schools",'all=Post_Falls'); mySelect.options[mySelect.options.length] = new Option("Twin Falls vocational schools",'all=Twin_Falls'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Meridian[Meridian.length] = createMarker(new GPoint(-116.38866425,43.60029221),"
Ada Professional-technical Center
357 E Watertower Ln Ste D
Meridian, ID 83642

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Ada Professional-technical Center",'Meridian=' + Meridian.length); Burley[Burley.length] = createMarker(new GPoint(-113.80543518,42.53311920),"
Cassia Regional Technical Center
1143 W 16th Street
Burley, ID 83318

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Cassia Regional Technical Center",'Burley=' + Burley.length); Greenleaf[Greenleaf.length] = createMarker(new GPoint(-116.81541443,43.67055893),"
Cossa
20567 Whittier Drive
Greenleaf, ID 83626

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Cossa",'Greenleaf=' + Greenleaf.length); Boise[Boise.length] = createMarker(new GPoint(-116.28309631,43.57556152),"
Dehryl A. Dennis Professional-technical Education High School
8201 W Victory Rd
Boise, ID 83709

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Dehryl A. Dennis Professional-technical Education High School",'Boise=' + Boise.length); Idaho_Falls[Idaho_Falls.length] = createMarker(new GPoint(-112.01912689,43.49362183),"
Eastern Idaho Professional-technical High School
690 John Adams Parkway
Idaho Falls, ID 83401

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Eastern Idaho Professional-technical High School",'Idaho_Falls=' + Idaho_Falls.length); Pocatello[Pocatello.length] = createMarker(new GPoint(-112.46638489,42.89087296),"
Gateway Professional-technical Center
3115 Pole Line Road
Pocatello, ID 83204

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Gateway Professional-technical Center",'Pocatello=' + Pocatello.length); Nampa[Nampa.length] = createMarker(new GPoint(-116.57463837,43.56138229),"
Idaho Center Of Advanced Technology
203 Lake Lowell Ave
Nampa, ID 83686

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Idaho Center Of Advanced Technology",'Nampa=' + Nampa.length); Twin_Falls[Twin_Falls.length] = createMarker(new GPoint(-114.65339661,42.25040054),"
Magic Valley Coop Service Agency High School
Po Box 1238
Twin Falls, ID 83303

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Magic Valley Coop Service Agency High School",'Twin_Falls=' + Twin_Falls.length); Cottonwood[Cottonwood.length] = createMarker(new GPoint(-116.37020111,46.00730133),"
Region Ii Professional-technical Academy
Po Box 158
Cottonwood, ID 83522

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Region Ii Professional-technical Academy",'Cottonwood=' + Cottonwood.length); Post_Falls[Post_Falls.length] = createMarker(new GPoint(-116.94805900,47.71153000),"
Riverbend Prof-tech Center
0525 W Clearwater Loop
Post Falls, ID 83854

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Riverbend Prof-tech Center",'Post_Falls=' + Post_Falls.length); Boise[Boise.length] = createMarker(new GPoint(-116.27917900,43.67971900),"
Treasure Valley Math/science
6801 North Gary Lane
Boise, ID 83714

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Treasure Valley Math/science",'Boise=' + Boise.length); maxLng = -112.01912689; maxLat = 47.71153000; minLng = -116.94805900; minLat = 42.25040054; reCenterMap(); map.removeOverlays(Boise); map.removeOverlays(Burley); map.removeOverlays(Cottonwood); map.removeOverlays(Greenleaf); map.removeOverlays(Idaho_Falls); map.removeOverlays(Meridian); map.removeOverlays(Nampa); map.removeOverlays(Pocatello); map.removeOverlays(Post_Falls); map.removeOverlays(Twin_Falls); setTimeout(function(){map.addOverlays(Boise)},1000); setTimeout(function(){map.addOverlays(Burley)},1000); setTimeout(function(){map.addOverlays(Cottonwood)},1000); setTimeout(function(){map.addOverlays(Greenleaf)},1000); setTimeout(function(){map.addOverlays(Idaho_Falls)},1000); setTimeout(function(){map.addOverlays(Meridian)},1000); setTimeout(function(){map.addOverlays(Nampa)},1000); setTimeout(function(){map.addOverlays(Pocatello)},1000); setTimeout(function(){map.addOverlays(Post_Falls)},1000); setTimeout(function(){map.addOverlays(Twin_Falls)},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(Boise); map.removeOverlays(Burley); map.removeOverlays(Cottonwood); map.removeOverlays(Greenleaf); map.removeOverlays(Idaho_Falls); map.removeOverlays(Meridian); map.removeOverlays(Nampa); map.removeOverlays(Pocatello); map.removeOverlays(Post_Falls); map.removeOverlays(Twin_Falls); 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(Meridian);map.removeOverlays(Boise); map.removeOverlays(Burley); map.removeOverlays(Cottonwood); map.removeOverlays(Greenleaf); map.removeOverlays(Idaho_Falls); map.removeOverlays(Meridian); map.removeOverlays(Nampa); map.removeOverlays(Pocatello); map.removeOverlays(Post_Falls); map.removeOverlays(Twin_Falls); map.addOverlays(Boise); centerByArray(Boise, false, false); cntMarker += Boise.length; map.addOverlays(Burley); centerByArray(Burley, false, false); cntMarker += Burley.length; map.addOverlays(Cottonwood); centerByArray(Cottonwood, false, false); cntMarker += Cottonwood.length; map.addOverlays(Greenleaf); centerByArray(Greenleaf, false, false); cntMarker += Greenleaf.length; map.addOverlays(Idaho_Falls); centerByArray(Idaho_Falls, false, false); cntMarker += Idaho_Falls.length; map.addOverlays(Meridian); centerByArray(Meridian, false, false); cntMarker += Meridian.length; map.addOverlays(Nampa); centerByArray(Nampa, false, false); cntMarker += Nampa.length; map.addOverlays(Pocatello); centerByArray(Pocatello, false, false); cntMarker += Pocatello.length; map.addOverlays(Post_Falls); centerByArray(Post_Falls, false, false); cntMarker += Post_Falls.length; map.addOverlays(Twin_Falls); centerByArray(Twin_Falls, false, false); cntMarker += Twin_Falls.length; centerByArray(Meridian,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'); } }