function addMarkers() { mySelect = document.getElementById('selection'); Ashville = [];Circleville = [];Derby = [];Mount_Sterling = [];New_Holland = [];Kingston = [];Commercial_Point = [];Williamsport = [];mySelect.options[mySelect.options.length] = new Option("Ashville schools",'all=Ashville'); mySelect.options[mySelect.options.length] = new Option("Circleville schools",'all=Circleville'); mySelect.options[mySelect.options.length] = new Option("Commercial Point schools",'all=Commercial_Point'); mySelect.options[mySelect.options.length] = new Option("Derby schools",'all=Derby'); mySelect.options[mySelect.options.length] = new Option("Kingston schools",'all=Kingston'); mySelect.options[mySelect.options.length] = new Option("Mount Sterling schools",'all=Mount_Sterling'); mySelect.options[mySelect.options.length] = new Option("New Holland schools",'all=New_Holland'); mySelect.options[mySelect.options.length] = new Option("Williamsport schools",'all=Williamsport'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Ashville[Ashville.length] = createMarker(new GPoint(-82.94942474,39.71511078),"
Ashville Elementary School
90 Walnut St
Ashville, OH 43103

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Ashville Elementary School",'Ashville=' + Ashville.length); Circleville[Circleville.length] = createMarker(new GPoint(-82.93700409,39.61458969),"
Atwater Elementary School
870 Atwater Ave
Circleville, OH 43113

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Atwater Elementary School",'Circleville=' + Circleville.length); Circleville[Circleville.length] = createMarker(new GPoint(-82.92523956,39.60693359),"
Circleville High School
380 Clark Dr
Circleville, OH 43113

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Circleville High School",'Circleville=' + Circleville.length); Circleville[Circleville.length] = createMarker(new GPoint(-82.95204163,39.58761215),"
Court Elementary School
1250 S Court St
Circleville, OH 43113

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Court Elementary School",'Circleville=' + Circleville.length); Derby[Derby.length] = createMarker(new GPoint(-83.20225525,39.76522827),"
Darby Elementary School
12051 London Rd
Derby, OH 43117

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Darby Elementary School",'Derby=' + Derby.length); Circleville[Circleville.length] = createMarker(new GPoint(-82.94732666,39.59750748),"
Everts Middle School
520 S Court St
Circleville, OH 43113

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Everts Middle School",'Circleville=' + Circleville.length); Circleville[Circleville.length] = createMarker(new GPoint(-82.84915924,39.56171417),"
George Mcdowell-exchange Junior High School
9579 Tarlton Rd
Circleville, OH 43113

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("George Mcdowell-exchange Junior High School",'Circleville=' + Circleville.length); Circleville[Circleville.length] = createMarker(new GPoint(-83.01329803,39.64237976),"
Jackson Elementary School
20010 Fox Rd
Circleville, OH 43113

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Jackson Elementary School",'Circleville=' + Circleville.length); Circleville[Circleville.length] = createMarker(new GPoint(-82.84925079,39.56172180),"
Logan Elm High School
9575 Tarlton Rd
Circleville, OH 43113

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Logan Elm High School",'Circleville=' + Circleville.length); Mount_Sterling[Mount_Sterling.length] = createMarker(new GPoint(-83.17910004,39.67404938),"
Monroe Elementary School
12364 St Rt 56 W
Mount Sterling, OH 43143

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Monroe Elementary School",'Mount_Sterling=' + Mount_Sterling.length); Circleville[Circleville.length] = createMarker(new GPoint(-82.93824768,39.59740067),"
Mound Elementary School
424 E Mound St
Circleville, OH 43113

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mound Elementary School",'Circleville=' + Circleville.length); New_Holland[New_Holland.length] = createMarker(new GPoint(-83.25546265,39.55150986),"
New Holland Elementary School
110 S Main St
New Holland, OH 43145

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("New Holland Elementary School",'New_Holland=' + New_Holland.length); Circleville[Circleville.length] = createMarker(new GPoint(-82.92868042,39.60632706),"
Nicholas Elementary School
410 Nicholas Dr
Circleville, OH 43113

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Nicholas Elementary School",'Circleville=' + Circleville.length); Circleville[Circleville.length] = createMarker(new GPoint(-82.93156433,39.51589584),"
Pickaway Elementary School
28158 Kingston Pike
Circleville, OH 43113

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Pickaway Elementary School",'Circleville=' + Circleville.length); Circleville[Circleville.length] = createMarker(new GPoint(-82.95247650,39.59635925),"
Ralph C Starkey (cjcf) High School
640 Island Rd
Circleville, OH 43113

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Ralph C Starkey (cjcf) High School",'Circleville=' + Circleville.length); Kingston[Kingston.length] = createMarker(new GPoint(-82.78445435,39.51393890),"
Saltcreek Elementary School
13190 State Route 56
Kingston, OH 45644

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Saltcreek Elementary School",'Kingston=' + Kingston.length); Commercial_Point[Commercial_Point.length] = createMarker(new GPoint(-83.05889893,39.77000046),"
Scioto Elementary School
20 W Scioto St
Commercial Point, OH 43116

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Scioto Elementary School",'Commercial_Point=' + Commercial_Point.length); Ashville[Ashville.length] = createMarker(new GPoint(-82.94329834,39.72326279),"
Teays Valley High School
3887 State Route 752
Ashville, OH 43103

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Teays Valley High School",'Ashville=' + Ashville.length); Ashville[Ashville.length] = createMarker(new GPoint(-82.94348907,39.72257233),"
Teays Valley Middle School
383 Circleville Ave
Ashville, OH 43103

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Teays Valley Middle School",'Ashville=' + Ashville.length); Ashville[Ashville.length] = createMarker(new GPoint(-82.89280701,39.69003677),"
Walnut Elementary School
7150 Ashville Fairfield Rd
Ashville, OH 43103

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Walnut Elementary School",'Ashville=' + Ashville.length); Circleville[Circleville.length] = createMarker(new GPoint(-82.87886810,39.60535431),"
Washington Elementary School
7990 Stoutsville Pike
Circleville, OH 43113

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Washington Elementary School",'Circleville=' + Circleville.length); Williamsport[Williamsport.length] = createMarker(new GPoint(-83.11756897,39.65451050),"
Westfall Elementary School
9391 State Route 56
Williamsport, OH 43164

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Westfall Elementary School",'Williamsport=' + Williamsport.length); Williamsport[Williamsport.length] = createMarker(new GPoint(-83.11968231,39.65492249),"
Westfall High School
19463 Pherson Pike
Williamsport, OH 43164

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Westfall High School",'Williamsport=' + Williamsport.length); Williamsport[Williamsport.length] = createMarker(new GPoint(-83.12006378,39.65399170),"
Westfall Middle School
19545 Pherson Pike
Williamsport, OH 43164

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Westfall Middle School",'Williamsport=' + Williamsport.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(Ashville); map.removeOverlays(Circleville); map.removeOverlays(Commercial_Point); map.removeOverlays(Derby); map.removeOverlays(Kingston); map.removeOverlays(Mount_Sterling); map.removeOverlays(New_Holland); map.removeOverlays(Williamsport); 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(Ashville);map.removeOverlays(Ashville); map.removeOverlays(Circleville); map.removeOverlays(Commercial_Point); map.removeOverlays(Derby); map.removeOverlays(Kingston); map.removeOverlays(Mount_Sterling); map.removeOverlays(New_Holland); map.removeOverlays(Williamsport); map.addOverlays(Ashville); centerByArray(Ashville, false, false); cntMarker += Ashville.length; map.addOverlays(Circleville); centerByArray(Circleville, false, false); cntMarker += Circleville.length; map.addOverlays(Commercial_Point); centerByArray(Commercial_Point, false, false); cntMarker += Commercial_Point.length; map.addOverlays(Derby); centerByArray(Derby, false, false); cntMarker += Derby.length; map.addOverlays(Kingston); centerByArray(Kingston, false, false); cntMarker += Kingston.length; map.addOverlays(Mount_Sterling); centerByArray(Mount_Sterling, false, false); cntMarker += Mount_Sterling.length; map.addOverlays(New_Holland); centerByArray(New_Holland, false, false); cntMarker += New_Holland.length; map.addOverlays(Williamsport); centerByArray(Williamsport, false, false); cntMarker += Williamsport.length; centerByArray(Ashville,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'); } }