function addMarkers(){ mySelect = document.getElementById('selection'); Boston = [];Pittsfield = [];Fall_River = [];West_Barnstable = [];Franklin = [];Greenfield = [];Holyoke = [];Norwood = [];Swampscott = [];Wellesley_Hills = [];Brockton = [];Bedford = [];Gardner = [];Brookline = [];Danvers = [];Haverhill = [];Quincy = [];Worcester = [];Roxbury_Crossing = [];Springfield = [];mySelect.options[mySelect.options.length] = new Option("Bedford Schools",'all=Bedford'); mySelect.options[mySelect.options.length] = new Option("Boston Schools",'all=Boston'); mySelect.options[mySelect.options.length] = new Option("Brockton Schools",'all=Brockton'); mySelect.options[mySelect.options.length] = new Option("Brookline Schools",'all=Brookline'); mySelect.options[mySelect.options.length] = new Option("Danvers Schools",'all=Danvers'); mySelect.options[mySelect.options.length] = new Option("Fall River Schools",'all=Fall_River'); mySelect.options[mySelect.options.length] = new Option("Franklin Schools",'all=Franklin'); mySelect.options[mySelect.options.length] = new Option("Gardner Schools",'all=Gardner'); mySelect.options[mySelect.options.length] = new Option("Greenfield Schools",'all=Greenfield'); mySelect.options[mySelect.options.length] = new Option("Haverhill Schools",'all=Haverhill'); mySelect.options[mySelect.options.length] = new Option("Holyoke Schools",'all=Holyoke'); mySelect.options[mySelect.options.length] = new Option("Norwood Schools",'all=Norwood'); mySelect.options[mySelect.options.length] = new Option("Pittsfield Schools",'all=Pittsfield'); mySelect.options[mySelect.options.length] = new Option("Quincy Schools",'all=Quincy'); mySelect.options[mySelect.options.length] = new Option("Roxbury Crossing Schools",'all=Roxbury_Crossing'); mySelect.options[mySelect.options.length] = new Option("Springfield Schools",'all=Springfield'); mySelect.options[mySelect.options.length] = new Option("Swampscott Schools",'all=Swampscott'); mySelect.options[mySelect.options.length] = new Option("Wellesley Hills Schools",'all=Wellesley_Hills'); mySelect.options[mySelect.options.length] = new Option("West Barnstable Schools",'all=West_Barnstable'); mySelect.options[mySelect.options.length] = new Option("Worcester Schools",'all=Worcester'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); var tmpLatLng=0; var tmpLen=0; tmpLatLng=new GLatLng(42.35194299999999856,-71.0772079999999988); tmpLen=Boston.length; Boston[tmpLen] = createMarker(tmpLatLng,"
Bay State College
122 Commonwealth Avenue
Boston, MA 02116

[ View School Profile ]
",iconRd); Boston[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Bay State College",'Boston=' + Boston.length); tmpLatLng=new GLatLng(42.45779799999999681,-73.3168689999999969); tmpLen=Pittsfield.length; Pittsfield[tmpLen] = createMarker(tmpLatLng,"
Berkshire Community College
1350 West Street
Pittsfield, MA 01201

[ View School Profile ]
",iconGr); Pittsfield[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Berkshire Community College",'Pittsfield=' + Pittsfield.length); tmpLatLng=new GLatLng(41.71912499999999823,-71.1242759999999947); tmpLen=Fall_River.length; Fall_River[tmpLen] = createMarker(tmpLatLng,"
Bristol Community College
777 Elsbree St
Fall River, MA 02720

[ View School Profile ]
",iconGr); Fall_River[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Bristol Community College",'Fall_River=' + Fall_River.length); tmpLatLng=new GLatLng(42.37424000000000035,-71.0680200000000041); tmpLen=Boston.length; Boston[tmpLen] = createMarker(tmpLatLng,"
Bunker Hill Community College
250 New Rutherford Ave
Boston, MA 02129

[ View School Profile ]
",iconGr); Boston[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Bunker Hill Community College",'Boston=' + Boston.length); tmpLatLng=new GLatLng(41.64388600000000195,-70.2784800000000018); tmpLen=West_Barnstable.length; West_Barnstable[tmpLen] = createMarker(tmpLatLng,"
Cape Cod Community College
2240 Iyannough Rd
West Barnstable, MA 02668

[ View School Profile ]
",iconGr); West_Barnstable[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Cape Cod Community College",'West_Barnstable=' + West_Barnstable.length); tmpLatLng=new GLatLng(42.08686500000000307,-71.3994030000000066); tmpLen=Franklin.length; Franklin[tmpLen] = createMarker(tmpLatLng,"
Dean College
99 Main Street
Franklin, MA 02038

[ View School Profile ]
",iconRd); Franklin[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Dean College",'Franklin=' + Franklin.length); tmpLatLng=new GLatLng(42.35491199999999878,-71.0741289999999992); tmpLen=Boston.length; Boston[tmpLen] = createMarker(tmpLatLng,"
Fisher College
118 Beacon St
Boston, MA 02116

[ View School Profile ]
",iconRd); Boston[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Fisher College",'Boston=' + Boston.length); tmpLatLng=new GLatLng(42.35114599999999995,-71.0770090000000038); tmpLen=Boston.length; Boston[tmpLen] = createMarker(tmpLatLng,"
Gibbs College-boston
126 Newbury Street
Boston, MA 02116

[ View School Profile ]
",iconRd); Boston[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Gibbs College-boston",'Boston=' + Boston.length); tmpLatLng=new GLatLng(42.59896700000000180,-72.6270839999999964); tmpLen=Greenfield.length; Greenfield[tmpLen] = createMarker(tmpLatLng,"
Greenfield Community College
One College Dr
Greenfield, MA 01301

[ View School Profile ]
",iconGr); Greenfield[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Greenfield Community College",'Greenfield=' + Greenfield.length); tmpLatLng=new GLatLng(42.19360900000000214,-72.6472990000000038); tmpLen=Holyoke.length; Holyoke[tmpLen] = createMarker(tmpLatLng,"
Holyoke Community College
303 Homestead Ave
Holyoke, MA 01040

[ View School Profile ]
",iconGr); Holyoke[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Holyoke Community College",'Holyoke=' + Holyoke.length); tmpLatLng=new GLatLng(42.19442699999999746,-71.1997989999999987); tmpLen=Norwood.length; Norwood[tmpLen] = createMarker(tmpLatLng,"
Itt Technical Institute-norwood
333 Providence Highway, Rte 1
Norwood, MA 02062

[ View School Profile ]
",iconRd); Norwood[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Itt Technical Institute-norwood",'Norwood=' + Norwood.length); tmpLatLng=new GLatLng(42.27833700000000050,-71.0664050000000031); tmpLen=Boston.length; Boston[tmpLen] = createMarker(tmpLatLng,"
Laboure College
2120 Dorchester Ave
Boston, MA 02124

[ View School Profile ]
",iconRd); Boston[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Laboure College",'Boston=' + Boston.length); tmpLatLng=new GLatLng(42.46647000000000105,-70.8894839999999959); tmpLen=Swampscott.length; Swampscott[tmpLen] = createMarker(tmpLatLng,"
Marian Court College
35 Littles Point Rd
Swampscott, MA 01907

[ View School Profile ]
",iconRd); Swampscott[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Marian Court College",'Swampscott=' + Swampscott.length); tmpLatLng=new GLatLng(42.31359599999999687,-71.2660000000000053); tmpLen=Wellesley_Hills.length; Wellesley_Hills[tmpLen] = createMarker(tmpLatLng,"
Massachusetts Bay Community College
50 Oakland St
Wellesley Hills, MA 02481

[ View School Profile ]
",iconGr); Wellesley_Hills[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Massachusetts Bay Community College",'Wellesley_Hills=' + Wellesley_Hills.length); tmpLatLng=new GLatLng(42.07353299999999762,-70.9926959999999951); tmpLen=Brockton.length; Brockton[tmpLen] = createMarker(tmpLatLng,"
Massasoit Community College
One Massasoit Boulevard
Brockton, MA 02302

[ View School Profile ]
",iconGr); Brockton[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Massasoit Community College",'Brockton=' + Brockton.length); tmpLatLng=new GLatLng(42.50506000000000028,-71.2730200000000024); tmpLen=Bedford.length; Bedford[tmpLen] = createMarker(tmpLatLng,"
Middlesex Community College
Springs Rd
Bedford, MA 01730

[ View School Profile ]
",iconGr); Bedford[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Middlesex Community College",'Bedford=' + Bedford.length); tmpLatLng=new GLatLng(42.59314499999999981,-71.9868500000000040); tmpLen=Gardner.length; Gardner[tmpLen] = createMarker(tmpLatLng,"
Mount Wachusett Community College
444 Green St
Gardner, MA 01440

[ View School Profile ]
",iconGr); Gardner[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Mount Wachusett Community College",'Gardner=' + Gardner.length); tmpLatLng=new GLatLng(42.37754999999999938,-71.0636999999999972); tmpLen=Boston.length; Boston[tmpLen] = createMarker(tmpLatLng,"
New England College Of Finance
10 High Street, Suite 204
Boston, MA 02110

[ View School Profile ]
",iconRd); Boston[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("New England College Of Finance",'Boston=' + Boston.length); tmpLatLng=new GLatLng(42.33549699999999660,-71.1109960000000000); tmpLen=Brookline.length; Brookline[tmpLen] = createMarker(tmpLatLng,"
New England Institute Of Art
10 Brookline Place West
Brookline, MA 02445

[ View School Profile ]
",iconRd); Brookline[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("New England Institute Of Art",'Brookline=' + Brookline.length); tmpLatLng=new GLatLng(42.59109500000000281,-70.9654969999999991); tmpLen=Danvers.length; Danvers[tmpLen] = createMarker(tmpLatLng,"
North Shore Community College
1 Ferncroft Rd
Danvers, MA 01923

[ View School Profile ]
",iconGr); Danvers[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("North Shore Community College",'Danvers=' + Danvers.length); tmpLatLng=new GLatLng(42.79766399999999748,-71.0511300000000005); tmpLen=Haverhill.length; Haverhill[tmpLen] = createMarker(tmpLatLng,"
Northern Essex Community College
100 Elliott Street
Haverhill, MA 01830

[ View School Profile ]
",iconGr); Haverhill[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Northern Essex Community College",'Haverhill=' + Haverhill.length); tmpLatLng=new GLatLng(42.25223499999999887,-71.0011099999999970); tmpLen=Quincy.length; Quincy[tmpLen] = createMarker(tmpLatLng,"
Quincy College
34 Coddington St
Quincy, MA 02169

[ View School Profile ]
",iconGr); Quincy[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Quincy College",'Quincy=' + Quincy.length); tmpLatLng=new GLatLng(42.31523399999999668,-71.7965820000000007); tmpLen=Worcester.length; Worcester[tmpLen] = createMarker(tmpLatLng,"
Quinsigamond Community College
670 W Boylston St
Worcester, MA 01606

[ View School Profile ]
",iconGr); Worcester[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Quinsigamond Community College",'Worcester=' + Worcester.length); tmpLatLng=new GLatLng(42.33666500000000354,-71.0874309999999951); tmpLen=Roxbury_Crossing.length; Roxbury_Crossing[tmpLen] = createMarker(tmpLatLng,"
Roxbury Community College
1234 Columbus Ave
Roxbury Crossing, MA 02120

[ View School Profile ]
",iconGr); Roxbury_Crossing[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Roxbury Community College",'Roxbury_Crossing=' + Roxbury_Crossing.length); tmpLatLng=new GLatLng(42.10999400000000036,-72.5787320000000022); tmpLen=Springfield.length; Springfield[tmpLen] = createMarker(tmpLatLng,"
Springfield Technical Community College
1 Armory Sq
Springfield, MA 01105

[ View School Profile ]
",iconGr); Springfield[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Springfield Technical Community College",'Springfield=' + Springfield.length); tmpLatLng=new GLatLng(42.35290400000000232,-71.0643989999999945); tmpLen=Boston.length; Boston[tmpLen] = createMarker(tmpLatLng,"
Urban College Of Boston
178 Tremont St 7th Fl
Boston, MA 02111

[ View School Profile ]
",iconRd); Boston[tmpLen].point = tmpLatLng; mySelect.options[mySelect.options.length] = new Option("Urban College Of Boston",'Boston=' + Boston.length); map.removeOverlays(Bedford); map.removeOverlays(Boston); map.removeOverlays(Brockton); map.removeOverlays(Brookline); map.removeOverlays(Danvers); map.removeOverlays(Fall_River); map.removeOverlays(Franklin); map.removeOverlays(Gardner); map.removeOverlays(Greenfield); map.removeOverlays(Haverhill); map.removeOverlays(Holyoke); map.removeOverlays(Norwood); map.removeOverlays(Pittsfield); map.removeOverlays(Quincy); map.removeOverlays(Roxbury_Crossing); map.removeOverlays(Springfield); map.removeOverlays(Swampscott); map.removeOverlays(Wellesley_Hills); map.removeOverlays(West_Barnstable); map.removeOverlays(Worcester); setTimeout(function(){map.addOverlays(Bedford)},1000); setTimeout(function(){map.addOverlays(Boston)},1000); setTimeout(function(){map.addOverlays(Brockton)},1000); setTimeout(function(){map.addOverlays(Brookline)},1000); setTimeout(function(){map.addOverlays(Danvers)},1000); setTimeout(function(){map.addOverlays(Fall_River)},1000); setTimeout(function(){map.addOverlays(Franklin)},1000); setTimeout(function(){map.addOverlays(Gardner)},1000); setTimeout(function(){map.addOverlays(Greenfield)},1000); setTimeout(function(){map.addOverlays(Haverhill)},1000); setTimeout(function(){map.addOverlays(Holyoke)},1000); setTimeout(function(){map.addOverlays(Norwood)},1000); setTimeout(function(){map.addOverlays(Pittsfield)},1000); setTimeout(function(){map.addOverlays(Quincy)},1000); setTimeout(function(){map.addOverlays(Roxbury_Crossing)},1000); setTimeout(function(){map.addOverlays(Springfield)},1000); setTimeout(function(){map.addOverlays(Swampscott)},1000); setTimeout(function(){map.addOverlays(Wellesley_Hills)},1000); setTimeout(function(){map.addOverlays(West_Barnstable)},1000); setTimeout(function(){map.addOverlays(Worcester)},1000); getPoly("","state","","MA");} // End addStateMarkers JavaScript Function //open all when map is defined function openAll() { if (map) { selectChange("all"); } else { setTimeout("openAll()",200); } } // 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].point.x; var markLat = myArray[i].point.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].point.x; maxLat = myArray[0].point.y; minLng = myArray[0].point.x; minLat = myArray[0].point.y; } // Recenter map based on global max/mins function reCenterMap(){ //alert('#' + minLat + '#' + minLng + '#' + maxLat + '#' + maxLng); 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) { if (selection.options) { var _openNewWindow=true; var myVal = selection.options[selection.selectedIndex].value; } else { var _openNewWindow=false; var myVal=selection; } 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('schools-by-distance') == -1) window.open(location.href + '/map/all'); else window.open('/search////all'); map.removeOverlays(Bedford); map.removeOverlays(Boston); map.removeOverlays(Brockton); map.removeOverlays(Brookline); map.removeOverlays(Danvers); map.removeOverlays(Fall_River); map.removeOverlays(Franklin); map.removeOverlays(Gardner); map.removeOverlays(Greenfield); map.removeOverlays(Haverhill); map.removeOverlays(Holyoke); map.removeOverlays(Norwood); map.removeOverlays(Pittsfield); map.removeOverlays(Quincy); map.removeOverlays(Roxbury_Crossing); map.removeOverlays(Springfield); map.removeOverlays(Swampscott); map.removeOverlays(Wellesley_Hills); map.removeOverlays(West_Barnstable); map.removeOverlays(Worcester); 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(Boston);map.removeOverlays(Bedford); map.removeOverlays(Boston); map.removeOverlays(Brockton); map.removeOverlays(Brookline); map.removeOverlays(Danvers); map.removeOverlays(Fall_River); map.removeOverlays(Franklin); map.removeOverlays(Gardner); map.removeOverlays(Greenfield); map.removeOverlays(Haverhill); map.removeOverlays(Holyoke); map.removeOverlays(Norwood); map.removeOverlays(Pittsfield); map.removeOverlays(Quincy); map.removeOverlays(Roxbury_Crossing); map.removeOverlays(Springfield); map.removeOverlays(Swampscott); map.removeOverlays(Wellesley_Hills); map.removeOverlays(West_Barnstable); map.removeOverlays(Worcester); map.addOverlays(Bedford); centerByArray(Bedford, false, false); cntMarker += Bedford.length; map.addOverlays(Boston); centerByArray(Boston, false, false); cntMarker += Boston.length; map.addOverlays(Brockton); centerByArray(Brockton, false, false); cntMarker += Brockton.length; map.addOverlays(Brookline); centerByArray(Brookline, false, false); cntMarker += Brookline.length; map.addOverlays(Danvers); centerByArray(Danvers, false, false); cntMarker += Danvers.length; map.addOverlays(Fall_River); centerByArray(Fall_River, false, false); cntMarker += Fall_River.length; map.addOverlays(Franklin); centerByArray(Franklin, false, false); cntMarker += Franklin.length; map.addOverlays(Gardner); centerByArray(Gardner, false, false); cntMarker += Gardner.length; map.addOverlays(Greenfield); centerByArray(Greenfield, false, false); cntMarker += Greenfield.length; map.addOverlays(Haverhill); centerByArray(Haverhill, false, false); cntMarker += Haverhill.length; map.addOverlays(Holyoke); centerByArray(Holyoke, false, false); cntMarker += Holyoke.length; map.addOverlays(Norwood); centerByArray(Norwood, false, false); cntMarker += Norwood.length; map.addOverlays(Pittsfield); centerByArray(Pittsfield, false, false); cntMarker += Pittsfield.length; map.addOverlays(Quincy); centerByArray(Quincy, false, false); cntMarker += Quincy.length; map.addOverlays(Roxbury_Crossing); centerByArray(Roxbury_Crossing, false, false); cntMarker += Roxbury_Crossing.length; map.addOverlays(Springfield); centerByArray(Springfield, false, false); cntMarker += Springfield.length; map.addOverlays(Swampscott); centerByArray(Swampscott, false, false); cntMarker += Swampscott.length; map.addOverlays(Wellesley_Hills); centerByArray(Wellesley_Hills, false, false); cntMarker += Wellesley_Hills.length; map.addOverlays(West_Barnstable); centerByArray(West_Barnstable, false, false); cntMarker += West_Barnstable.length; map.addOverlays(Worcester); centerByArray(Worcester, false, false); cntMarker += Worcester.length; reCenterMap(); //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'); } } function createMarker(point, label, icon){ var marker = new GMarker(point, icon); var html = label; GEvent.addListener(marker, "click", function() { marker.openInfoWindowHtml(html); }); return marker; }