function addMarkers(){ mySelect = document.getElementById('selection'); Fitchburg = [];Leicester = [];Worcester = [];Mendon = [];South_Lancaster = [];Baldwinville = [];Ashburnham = [];Rutland = [];Hardwick = [];Milford = [];Southborough = [];Lancaster = [];Still_River = [];Whitinsville = [];Gardner = [];Millbury = [];Athol = [];Shrewsbury = [];Devens = [];Southbridge = [];Barre = [];Lunenburg = [];Winchendon = [];mySelect.options[mySelect.options.length] = new Option("Ashburnham schools",'all=Ashburnham'); mySelect.options[mySelect.options.length] = new Option("Athol schools",'all=Athol'); mySelect.options[mySelect.options.length] = new Option("Baldwinville schools",'all=Baldwinville'); mySelect.options[mySelect.options.length] = new Option("Barre schools",'all=Barre'); mySelect.options[mySelect.options.length] = new Option("Devens schools",'all=Devens'); mySelect.options[mySelect.options.length] = new Option("Fitchburg schools",'all=Fitchburg'); mySelect.options[mySelect.options.length] = new Option("Gardner schools",'all=Gardner'); mySelect.options[mySelect.options.length] = new Option("Hardwick schools",'all=Hardwick'); mySelect.options[mySelect.options.length] = new Option("Lancaster schools",'all=Lancaster'); mySelect.options[mySelect.options.length] = new Option("Leicester schools",'all=Leicester'); mySelect.options[mySelect.options.length] = new Option("Lunenburg schools",'all=Lunenburg'); mySelect.options[mySelect.options.length] = new Option("Mendon schools",'all=Mendon'); mySelect.options[mySelect.options.length] = new Option("Milford schools",'all=Milford'); mySelect.options[mySelect.options.length] = new Option("Millbury schools",'all=Millbury'); mySelect.options[mySelect.options.length] = new Option("Rutland schools",'all=Rutland'); mySelect.options[mySelect.options.length] = new Option("Shrewsbury schools",'all=Shrewsbury'); mySelect.options[mySelect.options.length] = new Option("South Lancaster schools",'all=South_Lancaster'); mySelect.options[mySelect.options.length] = new Option("Southborough schools",'all=Southborough'); mySelect.options[mySelect.options.length] = new Option("Southbridge schools",'all=Southbridge'); mySelect.options[mySelect.options.length] = new Option("Still River schools",'all=Still_River'); mySelect.options[mySelect.options.length] = new Option("Whitinsville schools",'all=Whitinsville'); mySelect.options[mySelect.options.length] = new Option("Winchendon schools",'all=Winchendon'); mySelect.options[mySelect.options.length] = new Option("Worcester schools",'all=Worcester'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Fitchburg[Fitchburg.length] = createMarker(new GPoint(-71.80739900,42.59178400),"
Applewild School
120 Prospect St
Fitchburg, MA 01420
Co-ed school, K-9
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Applewild School",'Fitchburg=' + Fitchburg.length); Leicester[Leicester.length] = createMarker(new GPoint(-71.88896000,42.25963800),"
Archway, Inc.
77 Mulberry Street
Leicester, MA 01524
Co-ed school, 6-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Archway, Inc.",'Leicester=' + Leicester.length); Worcester[Worcester.length] = createMarker(new GPoint(-71.81533800,42.30444700),"
Bancroft School
110 Shore Drive
Worcester, MA 01605
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bancroft School",'Worcester=' + Worcester.length); Mendon[Mendon.length] = createMarker(new GPoint(-71.50339500,42.10005200),"
Bethany Christian Academy
15 Cape Rd
Mendon, MA 01756
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bethany Christian Academy",'Mendon=' + Mendon.length); South_Lancaster[South_Lancaster.length] = createMarker(new GPoint(-71.68926800,42.44345200),"
Browning Elementary & South Lancaster Academy
Po Box 807
South Lancaster, MA 01561
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Browning Elementary & South Lancaster Academy",'South_Lancaster=' + South_Lancaster.length); Baldwinville[Baldwinville.length] = createMarker(new GPoint(-72.07468800,42.60744900),"
Cottage Hill Academy
Po Box 38 83 Hospital Road
Baldwinville, MA 01436
All-girls school, 6-12
[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Cottage Hill Academy",'Baldwinville=' + Baldwinville.length); Ashburnham[Ashburnham.length] = createMarker(new GPoint(-71.90835400,42.63580000),"
Cushing Academy
PO Box 8000, 39 School Street
Ashburnham, MA 01430
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Cushing Academy",'Ashburnham=' + Ashburnham.length); Rutland[Rutland.length] = createMarker(new GPoint(-71.95820000,42.37460000),"
Devereux School
Po Box 219 60 Miles Road
Rutland, MA 01543
Co-ed school, 12-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Devereux School",'Rutland=' + Rutland.length); Hardwick[Hardwick.length] = createMarker(new GPoint(-72.19140000,42.37090000),"
Eagle Hill School
Po Box 116
Hardwick, MA 01037
Co-ed school, 8-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Eagle Hill School",'Hardwick=' + Hardwick.length); Milford[Milford.length] = createMarker(new GPoint(-71.49525200,42.15812400),"
Evergreen Center
345 Fortune Blvd
Milford, MA 01757
Co-ed school, 3-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Evergreen Center",'Milford=' + Milford.length); Southborough[Southborough.length] = createMarker(new GPoint(-71.53288800,42.30531500),"
Fay School
48 Main Street
Southborough, MA 01772
Co-ed school, PK-9
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Fay School",'Southborough=' + Southborough.length); Worcester[Worcester.length] = createMarker(new GPoint(-71.77086700,42.29509900),"
First Assembly Christian Academy
30 Tyler Prentice Road
Worcester, MA 01605
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("First Assembly Christian Academy",'Worcester=' + Worcester.length); Lancaster[Lancaster.length] = createMarker(new GPoint(-71.67380400,42.46186700),"
Franklin Perkins School
971 Main St
Lancaster, MA 01523
Co-ed school, 1-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Franklin Perkins School",'Lancaster=' + Lancaster.length); Worcester[Worcester.length] = createMarker(new GPoint(-71.80142700,42.26560300),"
G Stanley Hall School
4 Mann Street
Worcester, MA 01602
Co-ed school, 4-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("G Stanley Hall School",'Worcester=' + Worcester.length); Worcester[Worcester.length] = createMarker(new GPoint(-71.78363600,42.24289000),"
Holy Name Central Catholic Jr/sr High School
144 Granite Street
Worcester, MA 01604
Co-ed school, 7-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Holy Name Central Catholic Jr/sr High School",'Worcester=' + Worcester.length); Still_River[Still_River.length] = createMarker(new GPoint(-71.61300000,42.48590000),"
Immaculate Heart Of Mary
Po Box 1000 282 Still River Rd
Still River, MA 01467
Co-ed school, 1-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Immaculate Heart Of Mary",'Still_River=' + Still_River.length); Whitinsville[Whitinsville.length] = createMarker(new GPoint(-71.66856300,42.11564400),"
Integritas Academy
Po Box 44
Whitinsville, MA 01588
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Integritas Academy",'Whitinsville=' + Whitinsville.length); Worcester[Worcester.length] = createMarker(new GPoint(-71.77320000,42.25450000),"
Kathleen Burns Preparatory School
81 Plantation Street 2nd Floor
Worcester, MA 01604
Co-ed school, 6-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Kathleen Burns Preparatory School",'Worcester=' + Worcester.length); Gardner[Gardner.length] = createMarker(new GPoint(-71.98517400,42.58356300),"
The Master's Christian Academy
155 Green St
Gardner, MA 01440
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The Master's Christian Academy",'Gardner=' + Gardner.length); Millbury[Millbury.length] = createMarker(new GPoint(-71.76408500,42.18939400),"
Mcgrath Ed Center
130 Elm Street
Millbury, MA 01527
Co-ed school, 7-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mcgrath Ed Center",'Millbury=' + Millbury.length); Mendon[Mendon.length] = createMarker(new GPoint(-71.49981800,42.09192800),"
Mendon Mennonite School
70 Cape Road
Mendon, MA 01756
Co-ed school, 1-10
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mendon Mennonite School",'Mendon=' + Mendon.length); Worcester[Worcester.length] = createMarker(new GPoint(-71.82577000,42.30206300),"
Mercy Centre
25 West Chester Street
Worcester, MA 01605
Co-ed school, 3-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mercy Centre",'Worcester=' + Worcester.length); Athol[Athol.length] = createMarker(new GPoint(-72.24270700,42.59035700),"
Miller's River Academy
250 S Main Street
Athol, MA 01331
All-boys school, 9-12
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Miller's River Academy",'Athol=' + Athol.length); Southborough[Southborough.length] = createMarker(new GPoint(-71.49922300,42.29600300),"
The New England Center For Children
33 Turnpike Road
Southborough, MA 01772
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The New England Center For Children",'Southborough=' + Southborough.length); Lancaster[Lancaster.length] = createMarker(new GPoint(-71.67700700,42.51806700),"
New River Academy
Po Box 609
Lancaster, MA 01523
All-girls school, 9-12
[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("New River Academy",'Lancaster=' + Lancaster.length); Worcester[Worcester.length] = createMarker(new GPoint(-71.82602400,42.28521400),"
Notre Dame Academy
425 Salisbury Street
Worcester, MA 01609
All-girls school, 9-12
[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Notre Dame Academy",'Worcester=' + Worcester.length); Fitchburg[Fitchburg.length] = createMarker(new GPoint(-71.79934200,42.57618900),"
Notre Dame Preparatory School
171 South Street
Fitchburg, MA 01420
Co-ed school, 7-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Notre Dame Preparatory School",'Fitchburg=' + Fitchburg.length); Lancaster[Lancaster.length] = createMarker(new GPoint(-71.68560000,42.47320000),"
Rfk Lancaster School
220 Old Common Road
Lancaster, MA 01523
All-boys school, 2-11
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Rfk Lancaster School",'Lancaster=' + Lancaster.length); Fitchburg[Fitchburg.length] = createMarker(new GPoint(-71.78448700,42.57707800),"
St. Bernard Central High School
45 Harvard Street
Fitchburg, MA 01420
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Bernard Central High School",'Fitchburg=' + Fitchburg.length); Shrewsbury[Shrewsbury.length] = createMarker(new GPoint(-71.72938800,42.29323900),"
St. John's High School
378 Main Street
Shrewsbury, MA 01545
All-boys school, 9-12
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("St. John's High School",'Shrewsbury=' + Shrewsbury.length); Southborough[Southborough.length] = createMarker(new GPoint(-71.53089200,42.30958100),"
St. Mark's School
25 Marlboro Road
Southborough, MA 01772
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Mark's School",'Southborough=' + Southborough.length); Worcester[Worcester.length] = createMarker(new GPoint(-71.79674900,42.25116300),"
St. Mary S Jr/sr High School
50 Richland Street
Worcester, MA 01610
Co-ed school, 7-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Mary S Jr/sr High School",'Worcester=' + Worcester.length); Worcester[Worcester.length] = createMarker(new GPoint(-71.82243400,42.30670700),"
St. Peter Marian Central Cathol
781 Grove St
Worcester, MA 01605
Co-ed school, 7-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Peter Marian Central Cathol",'Worcester=' + Worcester.length); Devens[Devens.length] = createMarker(new GPoint(-71.62375600,42.53964300),"
Seven Hills Academy
22 Grant Road
Devens, MA 01434
Co-ed school, 3-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Seven Hills Academy",'Devens=' + Devens.length); South_Lancaster[South_Lancaster.length] = createMarker(new GPoint(-71.68926800,42.44345200),"
South Lancaster Academy & Browning Elementary School
Po Box 1129
South Lancaster, MA 01561
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("South Lancaster Academy & Browning Elementary School",'South_Lancaster=' + South_Lancaster.length); Southbridge[Southbridge.length] = createMarker(new GPoint(-72.00100000,42.09057500),"
Southbridge Christian Academy
26 Ellis Road
Southbridge, MA 01550
Co-ed school, K-11
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Southbridge Christian Academy",'Southbridge=' + Southbridge.length); Barre[Barre.length] = createMarker(new GPoint(-72.10811700,42.42318900),"
Stetson School Inc.
455 South St. P.O. Box 309
Barre, MA 01055
All-boys school, 3-12
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Stetson School Inc.",'Barre=' + Barre.length); Lancaster[Lancaster.length] = createMarker(new GPoint(-71.68773700,42.46432600),"
Trivium School
471 Langen Road
Lancaster, MA 01523
Co-ed school, 7-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Trivium School",'Lancaster=' + Lancaster.length); Lunenburg[Lunenburg.length] = createMarker(new GPoint(-71.75268400,42.58570600),"
Twin City Christian School
194 Electric Ave
Lunenburg, MA 01462
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Twin City Christian School",'Lunenburg=' + Lunenburg.length); Whitinsville[Whitinsville.length] = createMarker(new GPoint(-71.65454600,42.10618000),"
Whitinsville Christian School
279 Linwood Ave
Whitinsville, MA 01588
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Whitinsville Christian School",'Whitinsville=' + Whitinsville.length); Winchendon[Winchendon.length] = createMarker(new GPoint(-72.03667400,42.67520400),"
The Winchendon School
172 Ash Street
Winchendon, MA 01475
Co-ed school, 8-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The Winchendon School",'Winchendon=' + Winchendon.length); Worcester[Worcester.length] = createMarker(new GPoint(-71.79243700,42.25264100),"
Worcester Academy
81 Providence Street
Worcester, MA 01604
Co-ed school, 6-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Worcester Academy",'Worcester=' + Worcester.length); Worcester[Worcester.length] = createMarker(new GPoint(-71.81574700,42.24778300),"
Worcester Kingdom Academy
91 Canterbury Street
Worcester, MA 01603
Co-ed school, 7-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Worcester Kingdom Academy",'Worcester=' + Worcester.length); Worcester[Worcester.length] = createMarker(new GPoint(-71.82447800,42.27132800),"
Yeshiva Achei Tmimim Academy
22 Newton Avenue
Worcester, MA 01602
Co-ed school, PK-11
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Yeshiva Achei Tmimim Academy",'Worcester=' + Worcester.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,11); /* 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/////2/' + showArray); map.removeOverlays(Ashburnham); map.removeOverlays(Athol); map.removeOverlays(Baldwinville); map.removeOverlays(Barre); map.removeOverlays(Devens); map.removeOverlays(Fitchburg); map.removeOverlays(Gardner); map.removeOverlays(Hardwick); map.removeOverlays(Lancaster); map.removeOverlays(Leicester); map.removeOverlays(Lunenburg); map.removeOverlays(Mendon); map.removeOverlays(Milford); map.removeOverlays(Millbury); map.removeOverlays(Rutland); map.removeOverlays(Shrewsbury); map.removeOverlays(South_Lancaster); map.removeOverlays(Southborough); map.removeOverlays(Southbridge); map.removeOverlays(Still_River); map.removeOverlays(Whitinsville); map.removeOverlays(Winchendon); 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(Fitchburg);map.removeOverlays(Ashburnham); map.removeOverlays(Athol); map.removeOverlays(Baldwinville); map.removeOverlays(Barre); map.removeOverlays(Devens); map.removeOverlays(Fitchburg); map.removeOverlays(Gardner); map.removeOverlays(Hardwick); map.removeOverlays(Lancaster); map.removeOverlays(Leicester); map.removeOverlays(Lunenburg); map.removeOverlays(Mendon); map.removeOverlays(Milford); map.removeOverlays(Millbury); map.removeOverlays(Rutland); map.removeOverlays(Shrewsbury); map.removeOverlays(South_Lancaster); map.removeOverlays(Southborough); map.removeOverlays(Southbridge); map.removeOverlays(Still_River); map.removeOverlays(Whitinsville); map.removeOverlays(Winchendon); map.removeOverlays(Worcester); map.addOverlays(Ashburnham); centerByArray(Ashburnham, false, false); cntMarker += Ashburnham.length; map.addOverlays(Athol); centerByArray(Athol, false, false); cntMarker += Athol.length; map.addOverlays(Baldwinville); centerByArray(Baldwinville, false, false); cntMarker += Baldwinville.length; map.addOverlays(Barre); centerByArray(Barre, false, false); cntMarker += Barre.length; map.addOverlays(Devens); centerByArray(Devens, false, false); cntMarker += Devens.length; map.addOverlays(Fitchburg); centerByArray(Fitchburg, false, false); cntMarker += Fitchburg.length; map.addOverlays(Gardner); centerByArray(Gardner, false, false); cntMarker += Gardner.length; map.addOverlays(Hardwick); centerByArray(Hardwick, false, false); cntMarker += Hardwick.length; map.addOverlays(Lancaster); centerByArray(Lancaster, false, false); cntMarker += Lancaster.length; map.addOverlays(Leicester); centerByArray(Leicester, false, false); cntMarker += Leicester.length; map.addOverlays(Lunenburg); centerByArray(Lunenburg, false, false); cntMarker += Lunenburg.length; map.addOverlays(Mendon); centerByArray(Mendon, false, false); cntMarker += Mendon.length; map.addOverlays(Milford); centerByArray(Milford, false, false); cntMarker += Milford.length; map.addOverlays(Millbury); centerByArray(Millbury, false, false); cntMarker += Millbury.length; map.addOverlays(Rutland); centerByArray(Rutland, false, false); cntMarker += Rutland.length; map.addOverlays(Shrewsbury); centerByArray(Shrewsbury, false, false); cntMarker += Shrewsbury.length; map.addOverlays(South_Lancaster); centerByArray(South_Lancaster, false, false); cntMarker += South_Lancaster.length; map.addOverlays(Southborough); centerByArray(Southborough, false, false); cntMarker += Southborough.length; map.addOverlays(Southbridge); centerByArray(Southbridge, false, false); cntMarker += Southbridge.length; map.addOverlays(Still_River); centerByArray(Still_River, false, false); cntMarker += Still_River.length; map.addOverlays(Whitinsville); centerByArray(Whitinsville, false, false); cntMarker += Whitinsville.length; map.addOverlays(Winchendon); centerByArray(Winchendon, false, false); cntMarker += Winchendon.length; map.addOverlays(Worcester); centerByArray(Worcester, false, false); cntMarker += Worcester.length; centerByArray(Fitchburg,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'); //window.open('/map.php?type=1&schools=&school_level=2&radius=&zipcode=&school_type_search=&school_type_code='); } } function createMarker(point, label, icon) { var marker = new GMarker(point, icon); var html = label; GEvent.addListener(marker, "click", function() { marker.openInfoWindowHtml(html); }); return marker; }