function addMarkers() { mySelect = document.getElementById('selection'); Barstow = [];Andalusia = [];Carbon_Cliff = [];Coal_Valley = [];Rock_Island = [];Moline = [];East_Moline = [];Silvis = [];Milan = [];Hampton = [];Illinois_City = [];Reynolds = [];Port_Byron = [];Taylor_Ridge = [];Sherrard = [];mySelect.options[mySelect.options.length] = new Option("Andalusia schools",'all=Andalusia'); mySelect.options[mySelect.options.length] = new Option("Barstow schools",'all=Barstow'); mySelect.options[mySelect.options.length] = new Option("Carbon Cliff schools",'all=Carbon_Cliff'); mySelect.options[mySelect.options.length] = new Option("Coal Valley schools",'all=Coal_Valley'); mySelect.options[mySelect.options.length] = new Option("East Moline schools",'all=East_Moline'); mySelect.options[mySelect.options.length] = new Option("Hampton schools",'all=Hampton'); mySelect.options[mySelect.options.length] = new Option("Illinois City schools",'all=Illinois_City'); mySelect.options[mySelect.options.length] = new Option("Milan schools",'all=Milan'); mySelect.options[mySelect.options.length] = new Option("Moline schools",'all=Moline'); mySelect.options[mySelect.options.length] = new Option("Port Byron schools",'all=Port_Byron'); mySelect.options[mySelect.options.length] = new Option("Reynolds schools",'all=Reynolds'); mySelect.options[mySelect.options.length] = new Option("Rock Island schools",'all=Rock_Island'); mySelect.options[mySelect.options.length] = new Option("Sherrard schools",'all=Sherrard'); mySelect.options[mySelect.options.length] = new Option("Silvis schools",'all=Silvis'); mySelect.options[mySelect.options.length] = new Option("Taylor Ridge schools",'all=Taylor_Ridge'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Barstow[Barstow.length] = createMarker(new GPoint(-90.35690308,41.51829910),"
",iconBl); mySelect.options[mySelect.options.length] = new Option("Aldrin Junior High School",'Barstow=' + Barstow.length); Andalusia[Andalusia.length] = createMarker(new GPoint(-90.73220062,41.43750000),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Andalusia Elementary School",'Andalusia=' + Andalusia.length); Carbon_Cliff[Carbon_Cliff.length] = createMarker(new GPoint(-90.39109802,41.49629974),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Apollo Elementary School",'Carbon_Cliff=' + Carbon_Cliff.length); Coal_Valley[Coal_Valley.length] = createMarker(new GPoint(-90.46727753,41.39635086),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Arrowhead Ranch Boys School",'Coal_Valley=' + Coal_Valley.length); Rock_Island[Rock_Island.length] = createMarker(new GPoint(-90.58626556,41.50374222),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Art Program Middle School",'Rock_Island=' + Rock_Island.length); Rock_Island[Rock_Island.length] = createMarker(new GPoint(-90.56272125,41.49363708),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Audubon Elementary School",'Rock_Island=' + Rock_Island.length); Moline[Moline.length] = createMarker(new GPoint(-90.46437073,41.50206375),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Benjamin Franklin Elementary School",'Moline=' + Moline.length); Coal_Valley[Coal_Valley.length] = createMarker(new GPoint(-90.46128082,41.44128036),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Bicentennial Elementary School",'Coal_Valley=' + Coal_Valley.length); East_Moline[East_Moline.length] = createMarker(new GPoint(-90.43671417,41.48341751),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Black Hawk Ed Center",'East_Moline=' + East_Moline.length); Silvis[Silvis.length] = createMarker(new GPoint(-90.41541290,41.48719788),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Bowlesburg Elementary School",'Silvis=' + Silvis.length); Moline[Moline.length] = createMarker(new GPoint(-90.47098541,41.46976089),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Butterworth Elementary School",'Moline=' + Moline.length); Milan[Milan.length] = createMarker(new GPoint(-90.56320190,41.40634537),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Coyne Center Elementary School",'Milan=' + Milan.length); Rock_Island[Rock_Island.length] = createMarker(new GPoint(-90.54390717,41.49003601),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Denkmann Elementary School",'Rock_Island=' + Rock_Island.length); Silvis[Silvis.length] = createMarker(new GPoint(-90.40077972,41.50022125),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Eagle Ridge School",'Silvis=' + Silvis.length); Rock_Island[Rock_Island.length] = createMarker(new GPoint(-90.58698273,41.47145844),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Earl H Hanson Elementary School",'Rock_Island=' + Rock_Island.length); East_Moline[East_Moline.length] = createMarker(new GPoint(-90.42181396,41.53176117),"",iconGr); mySelect.options[mySelect.options.length] = new Option("East Moline Correctional Center",'East_Moline=' + East_Moline.length); Rock_Island[Rock_Island.length] = createMarker(new GPoint(-90.58661652,41.47006989),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Edison Junior High School",'Rock_Island=' + Rock_Island.length); Moline[Moline.length] = createMarker(new GPoint(-90.53290558,41.50483704),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Ericsson Elementary School",'Moline=' + Moline.length); Rock_Island[Rock_Island.length] = createMarker(new GPoint(-90.55908966,41.47877884),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Eugene Field Elementary School",'Rock_Island=' + Rock_Island.length); Rock_Island[Rock_Island.length] = createMarker(new GPoint(-90.58623505,41.48583221),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Frances Willard Elementary School",'Rock_Island=' + Rock_Island.length); Moline[Moline.length] = createMarker(new GPoint(-90.51538086,41.48726273),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Garfield Elementary School",'Moline=' + Moline.length); Silvis[Silvis.length] = createMarker(new GPoint(-90.41204071,41.50564957),"",iconRd); mySelect.options[mySelect.options.length] = new Option("George O Barr School",'Silvis=' + Silvis.length); Moline[Moline.length] = createMarker(new GPoint(-90.47971344,41.49760056),"",iconRd); mySelect.options[mySelect.options.length] = new Option("George Washington Elementary School",'Moline=' + Moline.length); East_Moline[East_Moline.length] = createMarker(new GPoint(-90.44421387,41.49956131),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Glenview Middle School",'East_Moline=' + East_Moline.length); Rock_Island[Rock_Island.length] = createMarker(new GPoint(-90.58913422,41.50054932),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Grant Intensive Basic Elementary School",'Rock_Island=' + Rock_Island.length); Moline[Moline.length] = createMarker(new GPoint(-90.52796173,41.48043060),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Hamilton Elementary School",'Moline=' + Moline.length); Hampton[Hampton.length] = createMarker(new GPoint(-90.40740204,41.55469894),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Hampton Elementary School",'Hampton=' + Hampton.length); Rock_Island[Rock_Island.length] = createMarker(new GPoint(-90.57952118,41.50192261),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Hawthorne-irving Elementary School",'Rock_Island=' + Rock_Island.length); East_Moline[East_Moline.length] = createMarker(new GPoint(-90.45071411,41.50988770),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Hillcrest Elementary School",'East_Moline=' + East_Moline.length); Rock_Island[Rock_Island.length] = createMarker(new GPoint(-90.55096436,41.47133255),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Horace Mann Choice School",'Rock_Island=' + Rock_Island.length); Moline[Moline.length] = createMarker(new GPoint(-90.48631287,41.45333862),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Horace Mann Elementary School",'Moline=' + Moline.length); Illinois_City[Illinois_City.length] = createMarker(new GPoint(-90.90429687,41.39130020),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Illinois City Elementary School",'Illinois_City=' + Illinois_City.length); Moline[Moline.length] = createMarker(new GPoint(-90.48989900,41.49173300),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Interdist Ece Program",'Moline=' + Moline.length); Moline[Moline.length] = createMarker(new GPoint(-90.51971436,41.46886444),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Interdist Ece Program Elementary School",'Moline=' + Moline.length); Moline[Moline.length] = createMarker(new GPoint(-90.46291351,41.47555161),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Jane Addams Elementary School",'Moline=' + Moline.length); Moline[Moline.length] = createMarker(new GPoint(-90.49497986,41.48566437),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Jefferson Early Childhood Center",'Moline=' + Moline.length); Moline[Moline.length] = createMarker(new GPoint(-90.52164459,41.49162674),"",iconBl); mySelect.options[mySelect.options.length] = new Option("John Deere Middle School",'Moline=' + Moline.length); Rock_Island[Rock_Island.length] = createMarker(new GPoint(-90.57031250,41.50606155),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Lincoln Elementary School",'Rock_Island=' + Rock_Island.length); Moline[Moline.length] = createMarker(new GPoint(-90.52210999,41.49693680),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Lincoln-irving Elementary School",'Moline=' + Moline.length); Moline[Moline.length] = createMarker(new GPoint(-90.50128174,41.49608231),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Logan Elementary School",'Moline=' + Moline.length); Rock_Island[Rock_Island.length] = createMarker(new GPoint(-90.54299164,41.50456238),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Longfellow Elementary School",'Rock_Island=' + Rock_Island.length); Moline[Moline.length] = createMarker(new GPoint(-90.48831940,41.49141312),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Moline Alternative High School",'Moline=' + Moline.length); Moline[Moline.length] = createMarker(new GPoint(-90.48405457,41.49075317),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Moline Senior High School",'Moline=' + Moline.length); Carbon_Cliff[Carbon_Cliff.length] = createMarker(new GPoint(-90.39109802,41.49629974),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Phoenix Program High School",'Carbon_Cliff=' + Carbon_Cliff.length); Reynolds[Reynolds.length] = createMarker(new GPoint(-90.67496490,41.33093643),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Reynolds Elementary School",'Reynolds=' + Reynolds.length); Rock_Island[Rock_Island.length] = createMarker(new GPoint(-90.58671570,41.42407227),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Ridgewood Elementary School",'Rock_Island=' + Rock_Island.length); East_Moline[East_Moline.length] = createMarker(new GPoint(-90.44232941,41.50036240),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Ridgewood Elementary School",'East_Moline=' + East_Moline.length); Port_Byron[Port_Byron.length] = createMarker(new GPoint(-90.26769257,41.61379623),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Riverdale Elementary School",'Port_Byron=' + Port_Byron.length); Port_Byron[Port_Byron.length] = createMarker(new GPoint(-90.26773071,41.62356949),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Riverdale Middle School",'Port_Byron=' + Port_Byron.length); Port_Byron[Port_Byron.length] = createMarker(new GPoint(-90.33515930,41.60662842),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Riverdale Senior High School",'Port_Byron=' + Port_Byron.length); Moline[Moline.length] = createMarker(new GPoint(-90.48826599,41.49140549),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Rock Island Co Reg Safe School",'Moline=' + Moline.length); Rock_Island[Rock_Island.length] = createMarker(new GPoint(-90.57768250,41.48561859),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Rock Island High School",'Rock_Island=' + Rock_Island.length); Taylor_Ridge[Taylor_Ridge.length] = createMarker(new GPoint(-90.76567841,41.38686752),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Rockridge High School",'Taylor_Ridge=' + Taylor_Ridge.length); Taylor_Ridge[Taylor_Ridge.length] = createMarker(new GPoint(-90.76567841,41.38686752),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Rockridge Junior High School",'Taylor_Ridge=' + Taylor_Ridge.length); Moline[Moline.length] = createMarker(new GPoint(-90.48551178,41.49100876),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Roosevelt Elementary School",'Moline=' + Moline.length); Sherrard[Sherrard.length] = createMarker(new GPoint(-90.50469971,41.34090042),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Sherrard High School",'Sherrard=' + Sherrard.length); Sherrard[Sherrard.length] = createMarker(new GPoint(-90.50469971,41.34090042),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Sherrard Junior High School",'Sherrard=' + Sherrard.length); Silvis[Silvis.length] = createMarker(new GPoint(-90.41204071,41.50564957),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Silvis Junior High School",'Silvis=' + Silvis.length); Taylor_Ridge[Taylor_Ridge.length] = createMarker(new GPoint(-90.67204285,41.38866043),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Taylor Ridge Elementary School",'Taylor_Ridge=' + Taylor_Ridge.length); Milan[Milan.length] = createMarker(new GPoint(-90.57201385,41.43854141),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Thomas Jefferson Elementary School",'Milan=' + Milan.length); Rock_Island[Rock_Island.length] = createMarker(new GPoint(-90.57028961,41.50783539),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Thurgood Marshall Learning Center",'Rock_Island=' + Rock_Island.length); East_Moline[East_Moline.length] = createMarker(new GPoint(-90.43277740,41.49042511),"",iconGr); mySelect.options[mySelect.options.length] = new Option("United Township High School",'East_Moline=' + East_Moline.length); East_Moline[East_Moline.length] = createMarker(new GPoint(-90.43277740,41.49042511),"",iconGr); mySelect.options[mySelect.options.length] = new Option("United Twp Area Career Center",'East_Moline=' + East_Moline.length); Rock_Island[Rock_Island.length] = createMarker(new GPoint(-90.55291748,41.49316406),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Washington Junior High School",'Rock_Island=' + Rock_Island.length); East_Moline[East_Moline.length] = createMarker(new GPoint(-90.45197296,41.48921967),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Wells Elementary School",'East_Moline=' + East_Moline.length); Moline[Moline.length] = createMarker(new GPoint(-90.51323700,41.49653625),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Willard Elementary School",'Moline=' + Moline.length); Moline[Moline.length] = createMarker(new GPoint(-90.47047424,41.49963760),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Woodrow Wilson Middle School",'Moline=' + Moline.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,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(Andalusia); map.removeOverlays(Barstow); map.removeOverlays(Carbon_Cliff); map.removeOverlays(Coal_Valley); map.removeOverlays(East_Moline); map.removeOverlays(Hampton); map.removeOverlays(Illinois_City); map.removeOverlays(Milan); map.removeOverlays(Moline); map.removeOverlays(Port_Byron); map.removeOverlays(Reynolds); map.removeOverlays(Rock_Island); map.removeOverlays(Sherrard); map.removeOverlays(Silvis); map.removeOverlays(Taylor_Ridge); 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(Barstow);map.removeOverlays(Andalusia); map.removeOverlays(Barstow); map.removeOverlays(Carbon_Cliff); map.removeOverlays(Coal_Valley); map.removeOverlays(East_Moline); map.removeOverlays(Hampton); map.removeOverlays(Illinois_City); map.removeOverlays(Milan); map.removeOverlays(Moline); map.removeOverlays(Port_Byron); map.removeOverlays(Reynolds); map.removeOverlays(Rock_Island); map.removeOverlays(Sherrard); map.removeOverlays(Silvis); map.removeOverlays(Taylor_Ridge); map.addOverlays(Andalusia); centerByArray(Andalusia, false, false); cntMarker += Andalusia.length; map.addOverlays(Barstow); centerByArray(Barstow, false, false); cntMarker += Barstow.length; map.addOverlays(Carbon_Cliff); centerByArray(Carbon_Cliff, false, false); cntMarker += Carbon_Cliff.length; map.addOverlays(Coal_Valley); centerByArray(Coal_Valley, false, false); cntMarker += Coal_Valley.length; map.addOverlays(East_Moline); centerByArray(East_Moline, false, false); cntMarker += East_Moline.length; map.addOverlays(Hampton); centerByArray(Hampton, false, false); cntMarker += Hampton.length; map.addOverlays(Illinois_City); centerByArray(Illinois_City, false, false); cntMarker += Illinois_City.length; map.addOverlays(Milan); centerByArray(Milan, false, false); cntMarker += Milan.length; map.addOverlays(Moline); centerByArray(Moline, false, false); cntMarker += Moline.length; map.addOverlays(Port_Byron); centerByArray(Port_Byron, false, false); cntMarker += Port_Byron.length; map.addOverlays(Reynolds); centerByArray(Reynolds, false, false); cntMarker += Reynolds.length; map.addOverlays(Rock_Island); centerByArray(Rock_Island, false, false); cntMarker += Rock_Island.length; map.addOverlays(Sherrard); centerByArray(Sherrard, false, false); cntMarker += Sherrard.length; map.addOverlays(Silvis); centerByArray(Silvis, false, false); cntMarker += Silvis.length; map.addOverlays(Taylor_Ridge); centerByArray(Taylor_Ridge, false, false); cntMarker += Taylor_Ridge.length; centerByArray(Barstow,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'); } }