function addMarkers()
{
mySelect = document.getElementById('selection');
Hartford = [];Hartford[Hartford.length] = createMarker(new GPoint(-72.70678711,41.74064636),"
",iconGr);
mySelect.options[mySelect.options.length] = new Option("A. I. Prince Vocational School",'Hartford=' + Hartford.length);
Hartford[Hartford.length] = createMarker(new GPoint(-72.67593384,41.77219009),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Barnard-brown School",'Hartford=' + Hartford.length);
Hartford[Hartford.length] = createMarker(new GPoint(-72.70724487,41.73310852),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Batchelder School",'Hartford=' + Hartford.length);
Hartford[Hartford.length] = createMarker(new GPoint(-72.69787598,41.74923325),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Breakthrough Charter School",'Hartford=' + Hartford.length);
Hartford[Hartford.length] = createMarker(new GPoint(-72.70175934,41.79151917),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Breakthrough Magnet School",'Hartford=' + Hartford.length);
Hartford[Hartford.length] = createMarker(new GPoint(-72.67338562,41.74762344),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Bulkeley High School",'Hartford=' + Hartford.length);
Hartford[Hartford.length] = createMarker(new GPoint(-72.69013977,41.76150131),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Burns School",'Hartford=' + Hartford.length);
Hartford[Hartford.length] = createMarker(new GPoint(-72.67303467,41.74485397),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Burr School",'Hartford=' + Hartford.length);
Hartford[Hartford.length] = createMarker(new GPoint(-72.66795349,41.75856400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("C. R. E. C.",'Hartford=' + Hartford.length);
Hartford[Hartford.length] = createMarker(new GPoint(-72.67261900,41.76831500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Capitol Preparatory Magnet School",'Hartford=' + Hartford.length);
Hartford[Hartford.length] = createMarker(new GPoint(-72.67735291,41.78704834),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Clark School",'Hartford=' + Hartford.length);
Hartford[Hartford.length] = createMarker(new GPoint(-72.68053436,41.73473358),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Dr. Joseph Belizzi Middle School",'Hartford=' + Hartford.length);
Hartford[Hartford.length] = createMarker(new GPoint(-72.67290497,41.75930023),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Dr. Ramon E. Betances School",'Hartford=' + Hartford.length);
Hartford[Hartford.length] = createMarker(new GPoint(-72.67183685,41.74010086),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Dwight School",'Hartford=' + Hartford.length);
Hartford[Hartford.length] = createMarker(new GPoint(-72.70747375,41.79164124),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Fisher School",'Hartford=' + Hartford.length);
Hartford[Hartford.length] = createMarker(new GPoint(-72.69676971,41.78439713),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Fox Middle School",'Hartford=' + Hartford.length);
Hartford[Hartford.length] = createMarker(new GPoint(-72.70090100,41.76557800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Greater Hartford Classical",'Hartford=' + Hartford.length);
Hartford[Hartford.length] = createMarker(new GPoint(-72.66076660,41.79246140),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Hartford Community Correctional Center",'Hartford=' + Hartford.length);
Hartford[Hartford.length] = createMarker(new GPoint(-72.68684387,41.75120544),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Hartford Magnet Middle School",'Hartford=' + Hartford.length);
Hartford[Hartford.length] = createMarker(new GPoint(-72.68905400,41.77144000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Hartford Public High School",'Hartford=' + Hartford.length);
Hartford[Hartford.length] = createMarker(new GPoint(-72.68201447,41.76052475),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Hartford Transitional Learning Academy",'Hartford=' + Hartford.length);
Hartford[Hartford.length] = createMarker(new GPoint(-72.68186700,41.75935400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Hartford Transitional Learning Academy (seco",'Hartford=' + Hartford.length);
Hartford[Hartford.length] = createMarker(new GPoint(-72.70124054,41.74078751),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Hooker School",'Hartford=' + Hartford.length);
Hartford[Hartford.length] = createMarker(new GPoint(-72.69760895,41.79142761),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Jumoke Academy",'Hartford=' + Hartford.length);
Hartford[Hartford.length] = createMarker(new GPoint(-72.69380188,41.73500824),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Kennelly School",'Hartford=' + Hartford.length);
Hartford[Hartford.length] = createMarker(new GPoint(-72.66493225,41.75503159),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Kinsella School",'Hartford=' + Hartford.length);
Hartford[Hartford.length] = createMarker(new GPoint(-72.70034027,41.76340103),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Little Owls Learning Center",'Hartford=' + Hartford.length);
Hartford[Hartford.length] = createMarker(new GPoint(-72.68101501,41.74655533),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("M. D. Fox Elementary School",'Hartford=' + Hartford.length);
Hartford[Hartford.length] = createMarker(new GPoint(-72.69546509,41.78540421),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("M. L. King School",'Hartford=' + Hartford.length);
Hartford[Hartford.length] = createMarker(new GPoint(-72.69787598,41.74923325),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Mcdonough School",'Hartford=' + Hartford.length);
Hartford[Hartford.length] = createMarker(new GPoint(-72.68837738,41.78265762),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Milner School",'Hartford=' + Hartford.length);
Hartford[Hartford.length] = createMarker(new GPoint(-72.68697357,41.74943924),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Montessori Magnet School",'Hartford=' + Hartford.length);
Hartford[Hartford.length] = createMarker(new GPoint(-72.69813538,41.74639893),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Moylan School",'Hartford=' + Hartford.length);
Hartford[Hartford.length] = createMarker(new GPoint(-72.67417908,41.73067474),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Naylor School",'Hartford=' + Hartford.length);
Hartford[Hartford.length] = createMarker(new GPoint(-72.70724487,41.75702286),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Parkville Community Elementary School",'Hartford=' + Hartford.length);
Hartford[Hartford.length] = createMarker(new GPoint(-72.68149567,41.77432251),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Quirk Middle School",'Hartford=' + Hartford.length);
Hartford[Hartford.length] = createMarker(new GPoint(-72.70005798,41.79581833),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Rawson School",'Hartford=' + Hartford.length);
Hartford[Hartford.length] = createMarker(new GPoint(-72.68933868,41.75873184),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Sanchez School",'Hartford=' + Hartford.length);
Hartford[Hartford.length] = createMarker(new GPoint(-72.67642975,41.77764130),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Sand School",'Hartford=' + Hartford.length);
Hartford[Hartford.length] = createMarker(new GPoint(-72.68174744,41.79474258),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Simpson-waverly School",'Hartford=' + Hartford.length);
Hartford[Hartford.length] = createMarker(new GPoint(-72.68877411,41.76396561),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Special Education Program",'Hartford=' + Hartford.length);
Hartford[Hartford.length] = createMarker(new GPoint(-72.67832184,41.76732254),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Sport And Medical Sciences Academy",'Hartford=' + Hartford.length);
Hartford[Hartford.length] = createMarker(new GPoint(-72.68803406,41.76810074),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Sports Science Academy",'Hartford=' + Hartford.length);
Hartford[Hartford.length] = createMarker(new GPoint(-72.70388794,41.80410004),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Twain School",'Hartford=' + Hartford.length);
Hartford[Hartford.length] = createMarker(new GPoint(-72.70589400,41.77460700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("University High School",'Hartford=' + Hartford.length);
Hartford[Hartford.length] = createMarker(new GPoint(-72.70605469,41.80006790),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Weaver High School",'Hartford=' + Hartford.length);
Hartford[Hartford.length] = createMarker(new GPoint(-72.71149445,41.76886368),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Webster School",'Hartford=' + Hartford.length);
Hartford[Hartford.length] = createMarker(new GPoint(-72.69502258,41.77065277),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("West Middle School",'Hartford=' + Hartford.length);
Hartford[Hartford.length] = createMarker(new GPoint(-72.67683411,41.79495239),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Wish School",'Hartford=' + Hartford.length);
map.removeOverlays(Hartford);
setTimeout(function(){map.addOverlays(Hartford)},1000);
maxLng = -72.66076660;
maxLat = 41.80410004;
minLng = -72.71149445;
minLat = 41.73067474;
reCenterMap();
} // 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(Hartford);
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(Hartford);map.removeOverlays(Hartford);
map.addOverlays(Hartford);
centerByArray(Hartford, false, false);
cntMarker += Hartford.length;
centerByArray(Hartford,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');
}
}