function addMarkers() { mySelect = document.getElementById('selection'); Fremont = [];Bellevue = [];Clyde = [];Gibsonburg = [];Green_Springs = [];Burgoon = [];Kansas = [];Vickery = [];Lindsey = [];Woodville = [];mySelect.options[mySelect.options.length] = new Option("Bellevue schools",'all=Bellevue'); mySelect.options[mySelect.options.length] = new Option("Burgoon schools",'all=Burgoon'); mySelect.options[mySelect.options.length] = new Option("Clyde schools",'all=Clyde'); mySelect.options[mySelect.options.length] = new Option("Fremont schools",'all=Fremont'); mySelect.options[mySelect.options.length] = new Option("Gibsonburg schools",'all=Gibsonburg'); mySelect.options[mySelect.options.length] = new Option("Green Springs schools",'all=Green_Springs'); mySelect.options[mySelect.options.length] = new Option("Kansas schools",'all=Kansas'); mySelect.options[mySelect.options.length] = new Option("Lindsey schools",'all=Lindsey'); mySelect.options[mySelect.options.length] = new Option("Vickery schools",'all=Vickery'); mySelect.options[mySelect.options.length] = new Option("Woodville schools",'all=Woodville'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Fremont[Fremont.length] = createMarker(new GPoint(-83.10050201,41.33760452),"
Atkinson Elementary School
1100 Delaware Ave
Fremont, OH 43420

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Atkinson Elementary School",'Fremont=' + Fremont.length); Bellevue[Bellevue.length] = createMarker(new GPoint(-82.84345245,41.28144455),"
Bellevue High School
200 Oakland Ave
Bellevue, OH 44811

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bellevue High School",'Bellevue=' + Bellevue.length); Clyde[Clyde.length] = createMarker(new GPoint(-82.98487854,41.29052734),"
Clyde High School
1015 Race St
Clyde, OH 43410

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Clyde High School",'Clyde=' + Clyde.length); Fremont[Fremont.length] = createMarker(new GPoint(-83.09606934,41.34667587),"
Croghan Elementary School
1110 Chestnut St
Fremont, OH 43420

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Croghan Elementary School",'Fremont=' + Fremont.length); Bellevue[Bellevue.length] = createMarker(new GPoint(-82.84504700,41.26796341),"
Ellis Elementary School
327 Ellis Ave
Bellevue, OH 44811

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Ellis Elementary School",'Bellevue=' + Bellevue.length); Fremont[Fremont.length] = createMarker(new GPoint(-83.11598206,41.34624481),"
Fremont Middle School
501 Croghan St
Fremont, OH 43420

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Fremont Middle School",'Fremont=' + Fremont.length); Fremont[Fremont.length] = createMarker(new GPoint(-83.12091827,41.36112976),"
Fremont Ross High School
1100 North St
Fremont, OH 43420

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Fremont Ross High School",'Fremont=' + Fremont.length); Gibsonburg[Gibsonburg.length] = createMarker(new GPoint(-83.32058716,41.37497330),"
Gibsonburg High School
740 S Main St
Gibsonburg, OH 43431

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Gibsonburg High School",'Gibsonburg=' + Gibsonburg.length); Gibsonburg[Gibsonburg.length] = createMarker(new GPoint(-83.32058716,41.37497330),"
Gibsonburg Middle School
740 S Main St
Gibsonburg, OH 43431

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Gibsonburg Middle School",'Gibsonburg=' + Gibsonburg.length); Green_Springs[Green_Springs.length] = createMarker(new GPoint(-83.05171967,41.26222229),"
Green Springs Elementary School
420 N Broadway St
Green Springs, OH 44836

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Green Springs Elementary School",'Green_Springs=' + Green_Springs.length); Fremont[Fremont.length] = createMarker(new GPoint(-83.12112427,41.34189224),"
Hayes Elementary School
916 Hayes Ave
Fremont, OH 43420

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hayes Elementary School",'Fremont=' + Fremont.length); Gibsonburg[Gibsonburg.length] = createMarker(new GPoint(-83.33085632,41.38219452),"
James J Hilfiker Elementary School
301 S Sunset Ave
Gibsonburg, OH 43431

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("James J Hilfiker Elementary School",'Gibsonburg=' + Gibsonburg.length); Burgoon[Burgoon.length] = createMarker(new GPoint(-83.23558044,41.29804230),"
Lakota East Elementary School
1582 State Route 590 S
Burgoon, OH 43407

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Lakota East Elementary School",'Burgoon=' + Burgoon.length); Kansas[Kansas.length] = createMarker(new GPoint(-83.32645416,41.26963806),"
Lakota High School
5186 County Road 13
Kansas, OH 44841

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Lakota High School",'Kansas=' + Kansas.length); Fremont[Fremont.length] = createMarker(new GPoint(-83.14145660,41.33243942),"
Lutz Elementary School
1929 Buckland Ave
Fremont, OH 43420

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lutz Elementary School",'Fremont=' + Fremont.length); Clyde[Clyde.length] = createMarker(new GPoint(-82.98047638,41.30504990),"
Mcpherson Middle School
201 Spring St
Clyde, OH 43410

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Mcpherson Middle School",'Clyde=' + Clyde.length); Fremont[Fremont.length] = createMarker(new GPoint(-83.14643097,41.35430908),"
Otis Elementary School
718 N Brush St
Fremont, OH 43420

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Otis Elementary School",'Fremont=' + Fremont.length); Clyde[Clyde.length] = createMarker(new GPoint(-82.97508240,41.29790115),"
South Main Elementary School
821 S Main St
Clyde, OH 43410

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("South Main Elementary School",'Clyde=' + Clyde.length); Fremont[Fremont.length] = createMarker(new GPoint(-83.12116241,41.35617828),"
Stamm Elementary School
1038 Miller St
Fremont, OH 43420

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Stamm Elementary School",'Fremont=' + Fremont.length); Fremont[Fremont.length] = createMarker(new GPoint(-83.12548065,41.36568451),"
Technology Center
1220 Cedar St
Fremont, OH 43420

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Technology Center",'Fremont=' + Fremont.length); Vickery[Vickery.length] = createMarker(new GPoint(-82.89184570,41.39195251),"
Townsend Elementary School
1783 County Road 294
Vickery, OH 43464

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Townsend Elementary School",'Vickery=' + Vickery.length); Fremont[Fremont.length] = createMarker(new GPoint(-83.12783051,41.36433792),"
Vanguard Career Center
1306 Cedar St
Fremont, OH 43420

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Vanguard Career Center",'Fremont=' + Fremont.length); Clyde[Clyde.length] = createMarker(new GPoint(-82.98118591,41.30452347),"
Vine St Elementary School
521 Vine St
Clyde, OH 43410

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Vine St Elementary School",'Clyde=' + Clyde.length); Lindsey[Lindsey.length] = createMarker(new GPoint(-83.21971130,41.41709518),"
Washington Elementary School
109 W Lincoln St
Lindsey, OH 43442

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Washington Elementary School",'Lindsey=' + Lindsey.length); Woodville[Woodville.length] = createMarker(new GPoint(-83.36987305,41.45340347),"
Woodmore Elementary School
708 W Main St
Woodville, OH 43469

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Woodmore Elementary School",'Woodville=' + Woodville.length); Clyde[Clyde.length] = createMarker(new GPoint(-82.97484589,41.30410004),"
York Elementary School
2314 Us Route 20 E
Clyde, OH 43410

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("York Elementary School",'Clyde=' + Clyde.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(Bellevue); map.removeOverlays(Burgoon); map.removeOverlays(Clyde); map.removeOverlays(Fremont); map.removeOverlays(Gibsonburg); map.removeOverlays(Green_Springs); map.removeOverlays(Kansas); map.removeOverlays(Lindsey); map.removeOverlays(Vickery); map.removeOverlays(Woodville); 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(Fremont);map.removeOverlays(Bellevue); map.removeOverlays(Burgoon); map.removeOverlays(Clyde); map.removeOverlays(Fremont); map.removeOverlays(Gibsonburg); map.removeOverlays(Green_Springs); map.removeOverlays(Kansas); map.removeOverlays(Lindsey); map.removeOverlays(Vickery); map.removeOverlays(Woodville); map.addOverlays(Bellevue); centerByArray(Bellevue, false, false); cntMarker += Bellevue.length; map.addOverlays(Burgoon); centerByArray(Burgoon, false, false); cntMarker += Burgoon.length; map.addOverlays(Clyde); centerByArray(Clyde, false, false); cntMarker += Clyde.length; map.addOverlays(Fremont); centerByArray(Fremont, false, false); cntMarker += Fremont.length; map.addOverlays(Gibsonburg); centerByArray(Gibsonburg, false, false); cntMarker += Gibsonburg.length; map.addOverlays(Green_Springs); centerByArray(Green_Springs, false, false); cntMarker += Green_Springs.length; map.addOverlays(Kansas); centerByArray(Kansas, false, false); cntMarker += Kansas.length; map.addOverlays(Lindsey); centerByArray(Lindsey, false, false); cntMarker += Lindsey.length; map.addOverlays(Vickery); centerByArray(Vickery, false, false); cntMarker += Vickery.length; map.addOverlays(Woodville); centerByArray(Woodville, false, false); cntMarker += Woodville.length; centerByArray(Fremont,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'); } }