function addMarkers() { mySelect = document.getElementById('selection'); Norwich = [];Norwich[Norwich.length] = createMarker(new GPoint(-72.09780884,41.51752853),"
Bishop School
526 Main Street
Norwich, CT 06360

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Bishop School",'Norwich=' + Norwich.length); Norwich[Norwich.length] = createMarker(new GPoint(-72.08450317,41.53609848),"
Deborah-tennant Zinewicz School
30 Case St.
Norwich, CT 06360

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Deborah-tennant Zinewicz School",'Norwich=' + Norwich.length); Norwich[Norwich.length] = createMarker(new GPoint(-72.06127930,41.53306961),"
Greeneville School
165 Golden St.
Norwich, CT 06360

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Greeneville School",'Norwich=' + Norwich.length); Norwich[Norwich.length] = createMarker(new GPoint(-72.06062317,41.53094864),"
Hickory Street School
201 Hickory St.
Norwich, CT 06360

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Hickory Street School",'Norwich=' + Norwich.length); Norwich[Norwich.length] = createMarker(new GPoint(-72.08450317,41.53609848),"
Homebound High School
90 Town Street
Norwich, CT 06360

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Homebound High School",'Norwich=' + Norwich.length); Norwich[Norwich.length] = createMarker(new GPoint(-72.07642365,41.51115036),"
Integrated Day Charter School
68 Thermos Rd.
Norwich, CT 06360

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Integrated Day Charter School",'Norwich=' + Norwich.length); Norwich[Norwich.length] = createMarker(new GPoint(-72.10323334,41.52273560),"
John B. Stanton School
386 New London Tpke.
Norwich, CT 06360

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("John B. Stanton School",'Norwich=' + Norwich.length); Norwich[Norwich.length] = createMarker(new GPoint(-72.06529999,41.57277679),"
John M. Moriarty School
20 Lawlor Ln.
Norwich, CT 06360

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("John M. Moriarty School",'Norwich=' + Norwich.length); Norwich[Norwich.length] = createMarker(new GPoint(-72.07801819,41.54656219),"
Kelly Middle School
25 Mahan Dr.
Norwich, CT 06360

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Kelly Middle School",'Norwich=' + Norwich.length); Norwich[Norwich.length] = createMarker(new GPoint(-72.08326721,41.53653717),"
Norwich Free Academy
305 Broadway
Norwich, CT 06360

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Norwich Free Academy",'Norwich=' + Norwich.length); Norwich[Norwich.length] = createMarker(new GPoint(-72.07669830,41.54981232),"
Norwich High School
191 Hickory St.
Norwich, CT 06360

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Norwich High School",'Norwich=' + Norwich.length); Norwich[Norwich.length] = createMarker(new GPoint(-72.10456848,41.50884628),"
Norwich Vocational School
590 New London Tpke.
Norwich, CT 06360

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Norwich Vocational School",'Norwich=' + Norwich.length); Norwich[Norwich.length] = createMarker(new GPoint(-72.10145569,41.55061722),"
Samuel Huntington School
80 West Town St.
Norwich, CT 06360

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Samuel Huntington School",'Norwich=' + Norwich.length); Norwich[Norwich.length] = createMarker(new GPoint(-80.35080000,25.75748100),"
Teachers' Memorial Middle School
215 Teachers Dr.
Norwich, CT 06360

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Teachers' Memorial Middle School",'Norwich=' + Norwich.length); Norwich[Norwich.length] = createMarker(new GPoint(-72.11073303,41.51222992),"
Thomas W. Mahan School
94 Salem Tpke.
Norwich, CT 06360

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Thomas W. Mahan School",'Norwich=' + Norwich.length); Norwich[Norwich.length] = createMarker(new GPoint(-82.47956085,28.26277351),"
Uncas School
280 Elizabeth St.
Norwich, CT 06360

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Uncas School",'Norwich=' + Norwich.length); Norwich[Norwich.length] = createMarker(new GPoint(-80.21632500,25.75363200),"
Veterans' Memorial School
980 Crouch Ave.
Norwich, CT 06360

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Veterans' Memorial School",'Norwich=' + Norwich.length); Norwich[Norwich.length] = createMarker(new GPoint(-72.08107758,41.53105927),"
William A. Buckingham School
182 Cedar Street
Norwich, CT 06360

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("William A. Buckingham School",'Norwich=' + Norwich.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(Norwich); 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(Norwich);map.removeOverlays(Norwich); map.addOverlays(Norwich); centerByArray(Norwich, false, false); cntMarker += Norwich.length; centerByArray(Norwich,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'); } }