function addMarkers() { mySelect = document.getElementById('selection'); Adairville = [];Albany = [];Allen = [];Alvaton = [];Anchorage = [];Argillite = [];Artemus = [];Ashland = [];Auburn = [];Augusta = [];Avawam = [];Alexandria = [];Ashcamp = [];Ary = [];mySelect.options[mySelect.options.length] = new Option("Adairville schools",'all=Adairville'); mySelect.options[mySelect.options.length] = new Option("Albany schools",'all=Albany'); mySelect.options[mySelect.options.length] = new Option("Alexandria schools",'all=Alexandria'); mySelect.options[mySelect.options.length] = new Option("Allen schools",'all=Allen'); mySelect.options[mySelect.options.length] = new Option("Alvaton schools",'all=Alvaton'); mySelect.options[mySelect.options.length] = new Option("Anchorage schools",'all=Anchorage'); mySelect.options[mySelect.options.length] = new Option("Argillite schools",'all=Argillite'); mySelect.options[mySelect.options.length] = new Option("Artemus schools",'all=Artemus'); mySelect.options[mySelect.options.length] = new Option("Ary schools",'all=Ary'); mySelect.options[mySelect.options.length] = new Option("Ashcamp schools",'all=Ashcamp'); mySelect.options[mySelect.options.length] = new Option("Ashland schools",'all=Ashland'); mySelect.options[mySelect.options.length] = new Option("Auburn schools",'all=Auburn'); mySelect.options[mySelect.options.length] = new Option("Augusta schools",'all=Augusta'); mySelect.options[mySelect.options.length] = new Option("Avawam schools",'all=Avawam'); Adairville[Adairville.length] = createMarker(new GPoint(-86.85551453,36.67251968),"
Adairville Elementary School
226 School Ave
Adairville, KY 42202

[ View School Profile ]
",iconRd); Albany[Albany.length] = createMarker(new GPoint(-85.14142609,36.69792175),"
Albany Elementary School
819 Third St
Albany, KY 42602

[ View School Profile ]
",iconRd); Allen[Allen.length] = createMarker(new GPoint(-82.71730042,37.61479950),"
Allen Elementary School
112 Eagle Ln
Allen, KY 41601

[ View School Profile ]
",iconRd); Alvaton[Alvaton.length] = createMarker(new GPoint(-86.38950348,36.87630081),"
Alvaton Elementary School
1 Robert Morgan Ln
Alvaton, KY 42122

[ View School Profile ]
",iconRd); Anchorage[Anchorage.length] = createMarker(new GPoint(-85.53916168,38.26377106),"
Anchorage Public Elementary School
11400 Ridge Rd
Anchorage, KY 40223

[ View School Profile ]
",iconRd); Argillite[Argillite.length] = createMarker(new GPoint(-82.87129974,38.51089859),"
Argillite Elementary School
4157 St. Rt. 1
Argillite, KY 41121

[ View School Profile ]
",iconRd); Artemus[Artemus.length] = createMarker(new GPoint(-83.83180237,36.83789825),"
Artemus Elementary School
180 Church St.
Artemus, KY 40903

[ View School Profile ]
",iconRd); Ashland[Ashland.length] = createMarker(new GPoint(-82.64318085,38.47785187),"
Ashland Central Alternative School
1420 Central Ave
Ashland, KY 41101

[ View School Profile ]
",iconGr); Ashland[Ashland.length] = createMarker(new GPoint(-82.64279100,38.48159500),"
Ashland Day Treatment Center Alt Center
N
Ashland, KY 41105

[ View School Profile ]
",iconGr); Auburn[Auburn.length] = createMarker(new GPoint(-86.71515656,36.86676788),"
Auburn Elementary School
221 College St
Auburn, KY 42206

[ View School Profile ]
",iconRd); Augusta[Augusta.length] = createMarker(new GPoint(-84.00366211,38.77296448),"
Augusta Elementary School
207 Bracken St
Augusta, KY 41002

[ View School Profile ]
",iconRd); Augusta[Augusta.length] = createMarker(new GPoint(-84.00366211,38.77296448),"
Augusta High School
207 Bracken St
Augusta, KY 41002

[ View School Profile ]
",iconGr); Anchorage[Anchorage.length] = createMarker(new GPoint(-85.54204559,38.26635361),"
Bellwood Presbyterian Home For Children
11103 Park Rd
Anchorage, KY 40223

[ View School Profile ]
",iconGr); Avawam[Avawam.length] = createMarker(new GPoint(-83.21304321,37.20140076),"
Big Creek Elementary School
N
Avawam, KY 41701

[ View School Profile ]
",iconRd); Ashland[Ashland.length] = createMarker(new GPoint(-82.70426600,38.37603100),"
Boyd Co Career & Tech Educ Ctr Voc School
12300 Midland Trail Rd
Ashland, KY 41102

[ View School Profile ]
",iconGr); Ashland[Ashland.length] = createMarker(new GPoint(-82.70252228,38.37932587),"
Boyd County High School
12307 Midland Trail Rd
Ashland, KY 41102

[ View School Profile ]
",iconGr); Ashland[Ashland.length] = createMarker(new GPoint(-82.69994354,38.42806244),"
Boyd County Middle School
1226 Summit Road
Ashland, KY 41102

[ View School Profile ]
",iconBl); Ashland[Ashland.length] = createMarker(new GPoint(-82.66980800,38.47439000),"
Boyd Regional Juvenile Detention Center
2420 Roberts Dr
Ashland, KY 41101

[ View School Profile ]
",iconGr); Alexandria[Alexandria.length] = createMarker(new GPoint(-84.39394900,38.95726100),"
Campbell County Central
51 Orchard Ln
Alexandria, KY 41001

[ View School Profile ]
",iconGr); Alexandria[Alexandria.length] = createMarker(new GPoint(-84.43480682,39.01856613),"
Campbell County Day Treatment Ctr Alt
51 Orchard Ln
Alexandria, KY 41001

[ View School Profile ]
",iconGr); Alexandria[Alexandria.length] = createMarker(new GPoint(-84.39277649,38.92036057),"
Campbell County High School
909 Camel Crossing
Alexandria, KY 41001

[ View School Profile ]
",iconGr); Alexandria[Alexandria.length] = createMarker(new GPoint(-84.39283752,38.96456528),"
Campbell County Middle School
8000 Alexandria Pk
Alexandria, KY 41001

[ View School Profile ]
",iconBl); Alexandria[Alexandria.length] = createMarker(new GPoint(-84.35639500,38.95944200),"
Campbell Ridge Elementary School
2500 Grandview Rd
Alexandria, KY 41001

[ View School Profile ]
",iconRd); Ashland[Ashland.length] = createMarker(new GPoint(-82.70188904,38.38092804),"
Cannonsburg Elementary School
12219 Midland Trail Rd
Ashland, KY 41102

[ View School Profile ]
",iconRd); Ashland[Ashland.length] = createMarker(new GPoint(-82.62280273,38.44977951),"
Charles Russell Elementary School
1100 Russell St
Ashland, KY 41101

[ View School Profile ]
",iconRd); Albany[Albany.length] = createMarker(new GPoint(-85.14510345,36.69729996),"
Clinton County High School
Rt 4 Box 35
Albany, KY 42602

[ View School Profile ]
",iconGr); Albany[Albany.length] = createMarker(new GPoint(-85.14510345,36.69729996),"
Clinton County Middle School
Rr 4 Box 90
Albany, KY 42602

[ View School Profile ]
",iconBl); Ashland[Ashland.length] = createMarker(new GPoint(-82.64015198,38.47600937),"
Crabbe Elementary School
520 17th St
Ashland, KY 41101

[ View School Profile ]
",iconRd); Ashland[Ashland.length] = createMarker(new GPoint(-82.63798523,38.47866821),"
Fairview Elementary School
258 Mcknight St Ww
Ashland, KY 41102

[ View School Profile ]
",iconRd); Ashland[Ashland.length] = createMarker(new GPoint(-82.67495728,38.48045731),"
Fairview High School
2123 Main St W
Ashland, KY 41102

[ View School Profile ]
",iconGr); Ashland[Ashland.length] = createMarker(new GPoint(-82.64982605,38.45573044),"
George M Verity Middle School
2800 Kansas St
Ashland, KY 41102

[ View School Profile ]
",iconBl); Alexandria[Alexandria.length] = createMarker(new GPoint(-84.39437866,38.86150742),"
Grant's Lick Elementary School
9944 Clay Ridge Rd.
Alexandria, KY 41001

[ View School Profile ]
",iconRd); Ashland[Ashland.length] = createMarker(new GPoint(-82.65740204,38.46343994),"
Hager Elementary School
1600 Blackburn Ave
Ashland, KY 41101

[ View School Profile ]
",iconRd); Ashland[Ashland.length] = createMarker(new GPoint(-82.65712738,38.47742844),"
Hatcher Elementary School
1820 Hickman St
Ashland, KY 41101

[ View School Profile ]
",iconRd); Alexandria[Alexandria.length] = createMarker(new GPoint(-84.38646698,38.90328217),"
John W. Reiley Elementary School
10631 Alexandria Pike
Alexandria, KY 41001

[ View School Profile ]
",iconRd); Ashcamp[Ashcamp.length] = createMarker(new GPoint(-82.43468475,37.26594925),"
Kentucky Youth Academy
Elkhorn Creek Rd
Ashcamp, KY 41512

[ View School Profile ]
",iconGr); Alexandria[Alexandria.length] = createMarker(new GPoint(-84.39052000,38.96453900),"
Northern Ky Learning Academy Alt School
51 Orchard Ln
Alexandria, KY 41001

[ View School Profile ]
",iconGr); Ashland[Ashland.length] = createMarker(new GPoint(-82.64442444,38.45515823),"
Oakview Elementary School
3111 Blackburn Ave
Ashland, KY 41101

[ View School Profile ]
",iconRd); Ashland[Ashland.length] = createMarker(new GPoint(-82.66346741,38.45534134),"
Paul G Blazer High School
Blazer Blvd
Ashland, KY 41102

[ View School Profile ]
",iconGr); Ashland[Ashland.length] = createMarker(new GPoint(-82.65321350,38.45384216),"
Poage Elementary School
3215 S 29th St
Ashland, KY 41102

[ View School Profile ]
",iconRd); Ary[Ary.length] = createMarker(new GPoint(-83.16228485,37.34149551),"
Robinson Elementary School
3311 Pigeon Roost Rd
Ary, KY 41712

[ View School Profile ]
",iconRd); Ashland[Ashland.length] = createMarker(new GPoint(-82.72142029,38.43362045),"
Summit Elementary School
830 State Rt 716
Ashland, KY 41102

[ View School Profile ]
",iconRd); } // 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(Adairville); map.removeOverlays(Albany); map.removeOverlays(Alexandria); map.removeOverlays(Allen); map.removeOverlays(Alvaton); map.removeOverlays(Anchorage); map.removeOverlays(Argillite); map.removeOverlays(Artemus); map.removeOverlays(Ary); map.removeOverlays(Ashcamp); map.removeOverlays(Ashland); map.removeOverlays(Auburn); map.removeOverlays(Augusta); map.removeOverlays(Avawam); 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(Adairville);map.removeOverlays(Adairville); map.removeOverlays(Albany); map.removeOverlays(Alexandria); map.removeOverlays(Allen); map.removeOverlays(Alvaton); map.removeOverlays(Anchorage); map.removeOverlays(Argillite); map.removeOverlays(Artemus); map.removeOverlays(Ary); map.removeOverlays(Ashcamp); map.removeOverlays(Ashland); map.removeOverlays(Auburn); map.removeOverlays(Augusta); map.removeOverlays(Avawam); map.addOverlays(Adairville); centerByArray(Adairville, false, false); cntMarker += Adairville.length; map.addOverlays(Albany); centerByArray(Albany, false, false); cntMarker += Albany.length; map.addOverlays(Alexandria); centerByArray(Alexandria, false, false); cntMarker += Alexandria.length; map.addOverlays(Allen); centerByArray(Allen, false, false); cntMarker += Allen.length; map.addOverlays(Alvaton); centerByArray(Alvaton, false, false); cntMarker += Alvaton.length; map.addOverlays(Anchorage); centerByArray(Anchorage, false, false); cntMarker += Anchorage.length; map.addOverlays(Argillite); centerByArray(Argillite, false, false); cntMarker += Argillite.length; map.addOverlays(Artemus); centerByArray(Artemus, false, false); cntMarker += Artemus.length; map.addOverlays(Ary); centerByArray(Ary, false, false); cntMarker += Ary.length; map.addOverlays(Ashcamp); centerByArray(Ashcamp, false, false); cntMarker += Ashcamp.length; map.addOverlays(Ashland); centerByArray(Ashland, false, false); cntMarker += Ashland.length; map.addOverlays(Auburn); centerByArray(Auburn, false, false); cntMarker += Auburn.length; map.addOverlays(Augusta); centerByArray(Augusta, false, false); cntMarker += Augusta.length; map.addOverlays(Avawam); centerByArray(Avawam, false, false); cntMarker += Avawam.length; centerByArray(Adairville,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'); } }