function addMarkers() { mySelect = document.getElementById('selection'); Bath = [];Biddeford = [];Augusta = [];Caribou = [];Machias = [];Brunswick = [];Ellsworth = [];Farmington = [];Naples = [];Lewiston = [];Rockland = [];Waterville = [];Lincoln = [];Norway = [];Portland = [];Presque_Isle = [];Houlton = [];Sanford = [];Mexico = [];Skowhegan = [];Calais = [];Frenchville = [];Dexter = [];Bangor = [];Van_Buren = [];Waldo = [];Westbrook = [];mySelect.options[mySelect.options.length] = new Option("Augusta vocational schools",'all=Augusta'); mySelect.options[mySelect.options.length] = new Option("Bangor vocational schools",'all=Bangor'); mySelect.options[mySelect.options.length] = new Option("Bath vocational schools",'all=Bath'); mySelect.options[mySelect.options.length] = new Option("Biddeford vocational schools",'all=Biddeford'); mySelect.options[mySelect.options.length] = new Option("Brunswick vocational schools",'all=Brunswick'); mySelect.options[mySelect.options.length] = new Option("Calais vocational schools",'all=Calais'); mySelect.options[mySelect.options.length] = new Option("Caribou vocational schools",'all=Caribou'); mySelect.options[mySelect.options.length] = new Option("Dexter vocational schools",'all=Dexter'); mySelect.options[mySelect.options.length] = new Option("Ellsworth vocational schools",'all=Ellsworth'); mySelect.options[mySelect.options.length] = new Option("Farmington vocational schools",'all=Farmington'); mySelect.options[mySelect.options.length] = new Option("Frenchville vocational schools",'all=Frenchville'); mySelect.options[mySelect.options.length] = new Option("Houlton vocational schools",'all=Houlton'); mySelect.options[mySelect.options.length] = new Option("Lewiston vocational schools",'all=Lewiston'); mySelect.options[mySelect.options.length] = new Option("Lincoln vocational schools",'all=Lincoln'); mySelect.options[mySelect.options.length] = new Option("Machias vocational schools",'all=Machias'); mySelect.options[mySelect.options.length] = new Option("Mexico vocational schools",'all=Mexico'); mySelect.options[mySelect.options.length] = new Option("Naples vocational schools",'all=Naples'); mySelect.options[mySelect.options.length] = new Option("Norway vocational schools",'all=Norway'); mySelect.options[mySelect.options.length] = new Option("Portland vocational schools",'all=Portland'); mySelect.options[mySelect.options.length] = new Option("Presque Isle vocational schools",'all=Presque_Isle'); mySelect.options[mySelect.options.length] = new Option("Rockland vocational schools",'all=Rockland'); mySelect.options[mySelect.options.length] = new Option("Sanford vocational schools",'all=Sanford'); mySelect.options[mySelect.options.length] = new Option("Skowhegan vocational schools",'all=Skowhegan'); mySelect.options[mySelect.options.length] = new Option("Van Buren vocational schools",'all=Van_Buren'); mySelect.options[mySelect.options.length] = new Option("Waldo vocational schools",'all=Waldo'); mySelect.options[mySelect.options.length] = new Option("Waterville vocational schools",'all=Waterville'); mySelect.options[mySelect.options.length] = new Option("Westbrook vocational schools",'all=Westbrook'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Bath[Bath.length] = createMarker(new GPoint(-69.81974030,43.91338730),"
Bath Regional Technology Center
800 High Street
Bath, ME 04530

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bath Regional Technology Center",'Bath=' + Bath.length); Biddeford[Biddeford.length] = createMarker(new GPoint(-70.46982574,43.49680710),"
Biddeford Regional Center Of Technical
10 Maplewood Avenue
Biddeford, ME 04005

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Biddeford Regional Center Of Technical",'Biddeford=' + Biddeford.length); Augusta[Augusta.length] = createMarker(new GPoint(-69.77976227,44.31053162),"
Capital Area Technology Center
40 Pierce Drive
Augusta, ME 04330

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Capital Area Technology Center",'Augusta=' + Augusta.length); Caribou[Caribou.length] = createMarker(new GPoint(-68.03065491,46.86336517),"
Caribou Regional Applied Technical Center
308 Sweden Street
Caribou, ME 04736

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Caribou Regional Applied Technical Center",'Caribou=' + Caribou.length); Machias[Machias.length] = createMarker(new GPoint(-67.46330261,44.70579910),"
Coastal Wash City Institutional Of Technical High School
Rr 1 Box 12a
Machias, ME 04654

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Coastal Wash City Institutional Of Technical High School",'Machias=' + Machias.length); Brunswick[Brunswick.length] = createMarker(new GPoint(-69.99186707,43.90766907),"
E Cumblnd-sag City Tech-reg 10 High School
68 Church Road
Brunswick, ME 04011

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("E Cumblnd-sag City Tech-reg 10 High School",'Brunswick=' + Brunswick.length); Ellsworth[Ellsworth.length] = createMarker(new GPoint(-68.45839691,44.57621765),"
Hancock County Technical Center
112 Boggy Brook Road
Ellsworth, ME 04605

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Hancock County Technical Center",'Ellsworth=' + Ellsworth.length); Farmington[Farmington.length] = createMarker(new GPoint(-70.13012695,44.63761902),"
Ken Foster Regional Applied Technical Center
173 Seamon Road
Farmington, ME 04938

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Ken Foster Regional Applied Technical Center",'Farmington=' + Farmington.length); Naples[Naples.length] = createMarker(new GPoint(-70.65819550,43.99736786),"
Lake Region Technology Center
1879 Roosevelt Trail
Naples, ME 04055

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Lake Region Technology Center",'Naples=' + Naples.length); Lewiston[Lewiston.length] = createMarker(new GPoint(-70.19943237,44.09474182),"
Lewiston Regional Technology Center
156 East Avenue
Lewiston, ME 04240

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Lewiston Regional Technology Center",'Lewiston=' + Lewiston.length); Rockland[Rockland.length] = createMarker(new GPoint(-69.10990143,44.09000015),"
Mid-coast School Of Tech-region 8
One Main Street
Rockland, ME 04841

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mid-coast School Of Tech-region 8",'Rockland=' + Rockland.length); Waterville[Waterville.length] = createMarker(new GPoint(-69.64225769,44.55096054),"
Mid-maine Technical Center
3 Brooklyn Avenue
Waterville, ME 04901

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mid-maine Technical Center",'Waterville=' + Waterville.length); Lincoln[Lincoln.length] = createMarker(new GPoint(-68.50738525,45.36313629),"
No Penobscot Tech-region 3 High School
35 West Broadway
Lincoln, ME 04457

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("No Penobscot Tech-region 3 High School",'Lincoln=' + Lincoln.length); Norway[Norway.length] = createMarker(new GPoint(-70.57530212,44.22019958),"
Oxford Hills Technical - Region 11 High School
256 Main St Po Box 313
Norway, ME 04268

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Oxford Hills Technical - Region 11 High School",'Norway=' + Norway.length); Portland[Portland.length] = createMarker(new GPoint(-70.29191589,43.69521713),"
Portland Arts & Technology High School
196 Allen Avenue
Portland, ME 04103

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Portland Arts & Technology High School",'Portland=' + Portland.length); Presque_Isle[Presque_Isle.length] = createMarker(new GPoint(-68.00600433,46.68453598),"
Presque Isle Regional Technical Center
79 Blake St Ste 3
Presque Isle, ME 04769

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Presque Isle Regional Technical Center",'Presque_Isle=' + Presque_Isle.length); Houlton[Houlton.length] = createMarker(new GPoint(-67.82707977,46.12707901),"
Region Two School Of Applied Technical
5 Bird St Po Box 307
Houlton, ME 04730

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Region Two School Of Applied Technical",'Houlton=' + Houlton.length); Sanford[Sanford.length] = createMarker(new GPoint(-70.78659058,43.45346069),"
Sanford Regional Vocational Center
52 Sanford High School Blvd
Sanford, ME 04073

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Sanford Regional Vocational Center",'Sanford=' + Sanford.length); Mexico[Mexico.length] = createMarker(new GPoint(-70.50602722,44.53468704),"
School Of Applied Tech-region 9
377 River Road
Mexico, ME 04257

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("School Of Applied Tech-region 9",'Mexico=' + Mexico.length); Skowhegan[Skowhegan.length] = createMarker(new GPoint(-69.72988129,44.74951935),"
Skowhegan Regional Technical Center
61 Academy Circle
Skowhegan, ME 04976

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Skowhegan Regional Technical Center",'Skowhegan=' + Skowhegan.length); Calais[Calais.length] = createMarker(new GPoint(-67.26560211,45.17010117),"
St Croix Regional Technology Center
34 Blue Devil Hill Suite 1
Calais, ME 04619

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Croix Regional Technology Center",'Calais=' + Calais.length); Frenchville[Frenchville.length] = createMarker(new GPoint(-68.39080048,47.28590012),"
St John Valley Technology Center
431 Us Rte 1 Po Box 509
Frenchville, ME 04745

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St John Valley Technology Center",'Frenchville=' + Frenchville.length); Dexter[Dexter.length] = createMarker(new GPoint(-69.29780579,45.02507401),"
Tri-county Regional Technical Center
14 Abbott Hill Road
Dexter, ME 04930

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Tri-county Regional Technical Center",'Dexter=' + Dexter.length); Bangor[Bangor.length] = createMarker(new GPoint(-68.73918152,44.82003403),"
United Technologies Ctr-region 4 High School
200 Hogan Road
Bangor, ME 04401

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("United Technologies Ctr-region 4 High School",'Bangor=' + Bangor.length); Van_Buren[Van_Buren.length] = createMarker(new GPoint(-67.94058228,47.16141510),"
Van Buren Regional Technology Center
169 Main Street
Van Buren, ME 04785

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Van Buren Regional Technology Center",'Van_Buren=' + Van_Buren.length); Waldo[Waldo.length] = createMarker(new GPoint(-69.06112671,44.44498444),"
Waldo County Technical Ctr-region 7 High School
1022 Waterville Road
Waldo, ME 04915

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Waldo County Technical Ctr-region 7 High School",'Waldo=' + Waldo.length); Westbrook[Westbrook.length] = createMarker(new GPoint(-70.35586548,43.67455673),"
Westbrook Regional Technology Center
125 Stroudwater Street
Westbrook, ME 04092

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Westbrook Regional Technology Center",'Westbrook=' + Westbrook.length); maxLng = -67.26560211; maxLat = 47.28590012; minLng = -70.78659058; minLat = 43.45346069; reCenterMap(); map.removeOverlays(Augusta); map.removeOverlays(Bangor); map.removeOverlays(Bath); map.removeOverlays(Biddeford); map.removeOverlays(Brunswick); map.removeOverlays(Calais); map.removeOverlays(Caribou); map.removeOverlays(Dexter); map.removeOverlays(Ellsworth); map.removeOverlays(Farmington); map.removeOverlays(Frenchville); map.removeOverlays(Houlton); map.removeOverlays(Lewiston); map.removeOverlays(Lincoln); map.removeOverlays(Machias); map.removeOverlays(Mexico); map.removeOverlays(Naples); map.removeOverlays(Norway); map.removeOverlays(Portland); map.removeOverlays(Presque_Isle); map.removeOverlays(Rockland); map.removeOverlays(Sanford); map.removeOverlays(Skowhegan); map.removeOverlays(Van_Buren); map.removeOverlays(Waldo); map.removeOverlays(Waterville); map.removeOverlays(Westbrook); setTimeout(function(){map.addOverlays(Augusta)},1000); setTimeout(function(){map.addOverlays(Bangor)},1000); setTimeout(function(){map.addOverlays(Bath)},1000); setTimeout(function(){map.addOverlays(Biddeford)},1000); setTimeout(function(){map.addOverlays(Brunswick)},1000); setTimeout(function(){map.addOverlays(Calais)},1000); setTimeout(function(){map.addOverlays(Caribou)},1000); setTimeout(function(){map.addOverlays(Dexter)},1000); setTimeout(function(){map.addOverlays(Ellsworth)},1000); setTimeout(function(){map.addOverlays(Farmington)},1000); setTimeout(function(){map.addOverlays(Frenchville)},1000); setTimeout(function(){map.addOverlays(Houlton)},1000); setTimeout(function(){map.addOverlays(Lewiston)},1000); setTimeout(function(){map.addOverlays(Lincoln)},1000); setTimeout(function(){map.addOverlays(Machias)},1000); setTimeout(function(){map.addOverlays(Mexico)},1000); setTimeout(function(){map.addOverlays(Naples)},1000); setTimeout(function(){map.addOverlays(Norway)},1000); setTimeout(function(){map.addOverlays(Portland)},1000); setTimeout(function(){map.addOverlays(Presque_Isle)},1000); setTimeout(function(){map.addOverlays(Rockland)},1000); setTimeout(function(){map.addOverlays(Sanford)},1000); setTimeout(function(){map.addOverlays(Skowhegan)},1000); setTimeout(function(){map.addOverlays(Van_Buren)},1000); setTimeout(function(){map.addOverlays(Waldo)},1000); setTimeout(function(){map.addOverlays(Waterville)},1000); setTimeout(function(){map.addOverlays(Westbrook)},1000); } // 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(Augusta); map.removeOverlays(Bangor); map.removeOverlays(Bath); map.removeOverlays(Biddeford); map.removeOverlays(Brunswick); map.removeOverlays(Calais); map.removeOverlays(Caribou); map.removeOverlays(Dexter); map.removeOverlays(Ellsworth); map.removeOverlays(Farmington); map.removeOverlays(Frenchville); map.removeOverlays(Houlton); map.removeOverlays(Lewiston); map.removeOverlays(Lincoln); map.removeOverlays(Machias); map.removeOverlays(Mexico); map.removeOverlays(Naples); map.removeOverlays(Norway); map.removeOverlays(Portland); map.removeOverlays(Presque_Isle); map.removeOverlays(Rockland); map.removeOverlays(Sanford); map.removeOverlays(Skowhegan); map.removeOverlays(Van_Buren); map.removeOverlays(Waldo); map.removeOverlays(Waterville); map.removeOverlays(Westbrook); 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(Bath);map.removeOverlays(Augusta); map.removeOverlays(Bangor); map.removeOverlays(Bath); map.removeOverlays(Biddeford); map.removeOverlays(Brunswick); map.removeOverlays(Calais); map.removeOverlays(Caribou); map.removeOverlays(Dexter); map.removeOverlays(Ellsworth); map.removeOverlays(Farmington); map.removeOverlays(Frenchville); map.removeOverlays(Houlton); map.removeOverlays(Lewiston); map.removeOverlays(Lincoln); map.removeOverlays(Machias); map.removeOverlays(Mexico); map.removeOverlays(Naples); map.removeOverlays(Norway); map.removeOverlays(Portland); map.removeOverlays(Presque_Isle); map.removeOverlays(Rockland); map.removeOverlays(Sanford); map.removeOverlays(Skowhegan); map.removeOverlays(Van_Buren); map.removeOverlays(Waldo); map.removeOverlays(Waterville); map.removeOverlays(Westbrook); map.addOverlays(Augusta); centerByArray(Augusta, false, false); cntMarker += Augusta.length; map.addOverlays(Bangor); centerByArray(Bangor, false, false); cntMarker += Bangor.length; map.addOverlays(Bath); centerByArray(Bath, false, false); cntMarker += Bath.length; map.addOverlays(Biddeford); centerByArray(Biddeford, false, false); cntMarker += Biddeford.length; map.addOverlays(Brunswick); centerByArray(Brunswick, false, false); cntMarker += Brunswick.length; map.addOverlays(Calais); centerByArray(Calais, false, false); cntMarker += Calais.length; map.addOverlays(Caribou); centerByArray(Caribou, false, false); cntMarker += Caribou.length; map.addOverlays(Dexter); centerByArray(Dexter, false, false); cntMarker += Dexter.length; map.addOverlays(Ellsworth); centerByArray(Ellsworth, false, false); cntMarker += Ellsworth.length; map.addOverlays(Farmington); centerByArray(Farmington, false, false); cntMarker += Farmington.length; map.addOverlays(Frenchville); centerByArray(Frenchville, false, false); cntMarker += Frenchville.length; map.addOverlays(Houlton); centerByArray(Houlton, false, false); cntMarker += Houlton.length; map.addOverlays(Lewiston); centerByArray(Lewiston, false, false); cntMarker += Lewiston.length; map.addOverlays(Lincoln); centerByArray(Lincoln, false, false); cntMarker += Lincoln.length; map.addOverlays(Machias); centerByArray(Machias, false, false); cntMarker += Machias.length; map.addOverlays(Mexico); centerByArray(Mexico, false, false); cntMarker += Mexico.length; map.addOverlays(Naples); centerByArray(Naples, false, false); cntMarker += Naples.length; map.addOverlays(Norway); centerByArray(Norway, false, false); cntMarker += Norway.length; map.addOverlays(Portland); centerByArray(Portland, false, false); cntMarker += Portland.length; map.addOverlays(Presque_Isle); centerByArray(Presque_Isle, false, false); cntMarker += Presque_Isle.length; map.addOverlays(Rockland); centerByArray(Rockland, false, false); cntMarker += Rockland.length; map.addOverlays(Sanford); centerByArray(Sanford, false, false); cntMarker += Sanford.length; map.addOverlays(Skowhegan); centerByArray(Skowhegan, false, false); cntMarker += Skowhegan.length; map.addOverlays(Van_Buren); centerByArray(Van_Buren, false, false); cntMarker += Van_Buren.length; map.addOverlays(Waldo); centerByArray(Waldo, false, false); cntMarker += Waldo.length; map.addOverlays(Waterville); centerByArray(Waterville, false, false); cntMarker += Waterville.length; map.addOverlays(Westbrook); centerByArray(Westbrook, false, false); cntMarker += Westbrook.length; centerByArray(Bath,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'); } }