function addMarkers()
{
mySelect = document.getElementById('selection');
South_Portland = [];Scarborough = [];Standish = [];Brunswick = [];New_Gloucester = [];Cape_Elizabeth = [];Gorham = [];Chebeague_Island = [];Cliff_Island = [];Westbrook = [];Casco = [];Falmouth = [];Portland = [];Cumberland = [];Sebago_Lake = [];Yarmouth = [];Freeport = [];Gray = [];Cumberland_Ctr = [];Harpswell = [];Harrison = [];Raymond = [];Naples = [];Long_Island = [];Windham = [];N_Yarmouth = [];Peaks_Island = [];Pownal = [];Sebago = [];Steep_Falls = [];Bridgton = [];mySelect.options[mySelect.options.length] = new Option("Bridgton schools",'all=Bridgton');
mySelect.options[mySelect.options.length] = new Option("Brunswick schools",'all=Brunswick');
mySelect.options[mySelect.options.length] = new Option("Cape Elizabeth schools",'all=Cape_Elizabeth');
mySelect.options[mySelect.options.length] = new Option("Casco schools",'all=Casco');
mySelect.options[mySelect.options.length] = new Option("Chebeague Island schools",'all=Chebeague_Island');
mySelect.options[mySelect.options.length] = new Option("Cliff Island schools",'all=Cliff_Island');
mySelect.options[mySelect.options.length] = new Option("Cumberland schools",'all=Cumberland');
mySelect.options[mySelect.options.length] = new Option("Cumberland Ctr schools",'all=Cumberland_Ctr');
mySelect.options[mySelect.options.length] = new Option("Falmouth schools",'all=Falmouth');
mySelect.options[mySelect.options.length] = new Option("Freeport schools",'all=Freeport');
mySelect.options[mySelect.options.length] = new Option("Gorham schools",'all=Gorham');
mySelect.options[mySelect.options.length] = new Option("Gray schools",'all=Gray');
mySelect.options[mySelect.options.length] = new Option("Harpswell schools",'all=Harpswell');
mySelect.options[mySelect.options.length] = new Option("Harrison schools",'all=Harrison');
mySelect.options[mySelect.options.length] = new Option("Long Island schools",'all=Long_Island');
mySelect.options[mySelect.options.length] = new Option("N Yarmouth schools",'all=N_Yarmouth');
mySelect.options[mySelect.options.length] = new Option("Naples schools",'all=Naples');
mySelect.options[mySelect.options.length] = new Option("New Gloucester schools",'all=New_Gloucester');
mySelect.options[mySelect.options.length] = new Option("Peaks Island schools",'all=Peaks_Island');
mySelect.options[mySelect.options.length] = new Option("Portland schools",'all=Portland');
mySelect.options[mySelect.options.length] = new Option("Pownal schools",'all=Pownal');
mySelect.options[mySelect.options.length] = new Option("Raymond schools",'all=Raymond');
mySelect.options[mySelect.options.length] = new Option("Scarborough schools",'all=Scarborough');
mySelect.options[mySelect.options.length] = new Option("Sebago schools",'all=Sebago');
mySelect.options[mySelect.options.length] = new Option("Sebago Lake schools",'all=Sebago_Lake');
mySelect.options[mySelect.options.length] = new Option("South Portland schools",'all=South_Portland');
mySelect.options[mySelect.options.length] = new Option("Standish schools",'all=Standish');
mySelect.options[mySelect.options.length] = new Option("Steep Falls schools",'all=Steep_Falls');
mySelect.options[mySelect.options.length] = new Option("Westbrook schools",'all=Westbrook');
mySelect.options[mySelect.options.length] = new Option("Windham schools",'all=Windham');
mySelect.options[mySelect.options.length] = new Option("Yarmouth schools",'all=Yarmouth');
mySelect.options[mySelect.options.length] = new Option("---------------------------",'');
South_Portland[South_Portland.length] = createMarker(new GPoint(-70.31127930,43.63857269),"
",iconGr);
mySelect.options[mySelect.options.length] = new Option("Arthur R. Gould Sch--lcydc High School",'South_Portland=' + South_Portland.length);
Scarborough[Scarborough.length] = createMarker(new GPoint(-70.33577728,43.59539032),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Benjamin Wentworth Intermediate",'Scarborough=' + Scarborough.length);
Scarborough[Scarborough.length] = createMarker(new GPoint(-70.36520386,43.55695724),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Blue Point School",'Scarborough=' + Scarborough.length);
Standish[Standish.length] = createMarker(new GPoint(-70.60038757,43.69756317),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Bonny Eagle High School",'Standish=' + Standish.length);
South_Portland[South_Portland.length] = createMarker(new GPoint(-70.24780273,43.63470078),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Brown Elementary School",'South_Portland=' + South_Portland.length);
Brunswick[Brunswick.length] = createMarker(new GPoint(-69.97975159,43.88518524),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Brunswick High School",'Brunswick=' + Brunswick.length);
Brunswick[Brunswick.length] = createMarker(new GPoint(-69.97698975,43.90292358),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Brunswick Junior High School",'Brunswick=' + Brunswick.length);
New_Gloucester[New_Gloucester.length] = createMarker(new GPoint(-70.25732422,43.90037918),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Burchard A Dunn School",'New_Gloucester=' + New_Gloucester.length);
Cape_Elizabeth[Cape_Elizabeth.length] = createMarker(new GPoint(-70.22669983,43.59125137),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Cape Elizabeth High School",'Cape_Elizabeth=' + Cape_Elizabeth.length);
Cape_Elizabeth[Cape_Elizabeth.length] = createMarker(new GPoint(-70.23088074,43.59580994),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Cape Elizabeth Middle School",'Cape_Elizabeth=' + Cape_Elizabeth.length);
Gorham[Gorham.length] = createMarker(new GPoint(-70.44161224,43.67699432),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Charles Shaw Junior High School",'Gorham=' + Gorham.length);
Chebeague_Island[Chebeague_Island.length] = createMarker(new GPoint(-70.11479950,43.73699951),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Chebeague Island School",'Chebeague_Island=' + Chebeague_Island.length);
Cliff_Island[Cliff_Island.length] = createMarker(new GPoint(-70.10489655,43.69630051),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Cliff Island School",'Cliff_Island=' + Cliff_Island.length);
Brunswick[Brunswick.length] = createMarker(new GPoint(-69.97351837,43.90161514),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Coffin School",'Brunswick=' + Brunswick.length);
Westbrook[Westbrook.length] = createMarker(new GPoint(-70.36079407,43.68886948),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Congin School",'Westbrook=' + Westbrook.length);
Casco[Casco.length] = createMarker(new GPoint(-70.55976868,43.98286438),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Crooked River Elementary School",'Casco=' + Casco.length);
Falmouth[Falmouth.length] = createMarker(new GPoint(-70.24707031,43.72630310),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("D W Lunt School",'Falmouth=' + Falmouth.length);
Portland[Portland.length] = createMarker(new GPoint(-70.29524231,43.67126465),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Deering High School",'Portland=' + Portland.length);
Cumberland[Cumberland.length] = createMarker(new GPoint(-70.24846649,43.79106522),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Drowne Road School",'Cumberland=' + Cumberland.length);
South_Portland[South_Portland.length] = createMarker(new GPoint(-70.27440643,43.62248230),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Dyer Elementary School",'South_Portland=' + South_Portland.length);
Brunswick[Brunswick.length] = createMarker(new GPoint(-69.99186707,43.90766907),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("E Cumblnd-sag City Tech-reg 10 High School",'Brunswick=' + Brunswick.length);
Sebago_Lake[Sebago_Lake.length] = createMarker(new GPoint(-70.64810181,43.86880112),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Edna Libby Elementary School",'Sebago_Lake=' + Sebago_Lake.length);
Scarborough[Scarborough.length] = createMarker(new GPoint(-70.34988403,43.61819839),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Eight Corners Elementary School",'Scarborough=' + Scarborough.length);
Portland[Portland.length] = createMarker(new GPoint(-70.29164100,43.69531700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Expeditionary Learning O B High School",'Portland=' + Portland.length);
Falmouth[Falmouth.length] = createMarker(new GPoint(-70.27103424,43.74067688),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Falmouth High School",'Falmouth=' + Falmouth.length);
Falmouth[Falmouth.length] = createMarker(new GPoint(-70.27267456,43.73831558),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Falmouth Middle School",'Falmouth=' + Falmouth.length);
Yarmouth[Yarmouth.length] = createMarker(new GPoint(-70.20121765,43.79688644),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Frank H Harrison Middle School",'Yarmouth=' + Yarmouth.length);
Westbrook[Westbrook.length] = createMarker(new GPoint(-70.36025238,43.68918610),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Fred C Wescott School",'Westbrook=' + Westbrook.length);
Portland[Portland.length] = createMarker(new GPoint(-70.31658173,43.67752838),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Fred P Hall School",'Portland=' + Portland.length);
Freeport[Freeport.length] = createMarker(new GPoint(-70.10724640,43.85623932),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Freeport High School",'Freeport=' + Freeport.length);
Freeport[Freeport.length] = createMarker(new GPoint(-70.10355377,43.86683655),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Freeport Middle School",'Freeport=' + Freeport.length);
Standish[Standish.length] = createMarker(new GPoint(-70.55027008,43.73606110),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("George E Jack School",'Standish=' + Standish.length);
Gorham[Gorham.length] = createMarker(new GPoint(-70.44431305,43.67426300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Gorham High School",'Gorham=' + Gorham.length);
Gorham[Gorham.length] = createMarker(new GPoint(-70.45089722,43.68817902),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Gorham Middle School",'Gorham=' + Gorham.length);
Falmouth[Falmouth.length] = createMarker(new GPoint(-70.27745819,43.67506027),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Governor Baxter School For Dea",'Falmouth=' + Falmouth.length);
Gray[Gray.length] = createMarker(new GPoint(-70.34638214,43.90273666),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Gray-new Gloucester High School",'Gray=' + Gray.length);
Gray[Gray.length] = createMarker(new GPoint(-70.34777832,43.90233231),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Gray-new Gloucester Middle School",'Gray=' + Gray.length);
Cumberland_Ctr[Cumberland_Ctr.length] = createMarker(new GPoint(-70.25698853,43.79808044),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Greely High School",'Cumberland_Ctr=' + Cumberland_Ctr.length);
Cumberland_Ctr[Cumberland_Ctr.length] = createMarker(new GPoint(-70.25698853,43.79808044),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Greely Junior High School",'Cumberland_Ctr=' + Cumberland_Ctr.length);
South_Portland[South_Portland.length] = createMarker(new GPoint(-70.24994659,43.62543106),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Hamlin Elementary School",'South_Portland=' + South_Portland.length);
Harpswell[Harpswell.length] = createMarker(new GPoint(-69.91255188,43.83835602),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Harpswell Islands School",'Harpswell=' + Harpswell.length);
Harrison[Harrison.length] = createMarker(new GPoint(-70.67494965,44.08691788),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Harrison Elementary School",'Harrison=' + Harrison.length);
Portland[Portland.length] = createMarker(new GPoint(-70.28850400,43.69932000),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Harrison Lyseth Elementary School",'Portland=' + Portland.length);
Brunswick[Brunswick.length] = createMarker(new GPoint(-69.96205139,43.91415024),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Hawthorne School",'Brunswick=' + Brunswick.length);
Portland[Portland.length] = createMarker(new GPoint(-70.26717377,43.65080261),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Howard C Reiche Community School",'Portland=' + Portland.length);
Portland[Portland.length] = createMarker(new GPoint(-70.25341034,43.67185593),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Jack Elementary School",'Portland=' + Portland.length);
Brunswick[Brunswick.length] = createMarker(new GPoint(-69.95338440,43.91553497),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Jordan Acres School",'Brunswick=' + Brunswick.length);
Raymond[Raymond.length] = createMarker(new GPoint(-70.44533539,43.93695068),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Jordan-small Middle School",'Raymond=' + Raymond.length);
South_Portland[South_Portland.length] = createMarker(new GPoint(-70.26764679,43.62880325),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Kaler Elementary School",'South_Portland=' + South_Portland.length);
Portland[Portland.length] = createMarker(new GPoint(-70.27499390,43.65827942),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("King Middle School",'Portland=' + Portland.length);
Naples[Naples.length] = createMarker(new GPoint(-70.65814972,43.99732971),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Lake Region High School",'Naples=' + Naples.length);
Naples[Naples.length] = createMarker(new GPoint(-70.65319824,44.00189972),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Lake Region Middle School",'Naples=' + Naples.length);
Naples[Naples.length] = createMarker(new GPoint(-70.65819550,43.99736786),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Lake Region Technology Center",'Naples=' + Naples.length);
Portland[Portland.length] = createMarker(new GPoint(-70.29489136,43.67625427),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Lincoln Middle School",'Portland=' + Portland.length);
Gorham[Gorham.length] = createMarker(new GPoint(-70.42225647,43.72472000),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Little Falls School",'Gorham=' + Gorham.length);
Long_Island[Long_Island.length] = createMarker(new GPoint(-70.16639709,43.68500137),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Long Island Elementary School",'Long_Island=' + Long_Island.length);
Portland[Portland.length] = createMarker(new GPoint(-70.29541016,43.67339325),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Longfellow School",'Portland=' + Portland.length);
Brunswick[Brunswick.length] = createMarker(new GPoint(-69.96237183,43.90461349),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Longfellow School",'Brunswick=' + Brunswick.length);
Portland[Portland.length] = createMarker(new GPoint(-70.28987122,43.70617676),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Lyman Moore Middle School",'Portland=' + Portland.length);
Cumberland_Ctr[Cumberland_Ctr.length] = createMarker(new GPoint(-70.25423431,43.79453659),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Mabel I Wilson School",'Cumberland_Ctr=' + Cumberland_Ctr.length);
South_Portland[South_Portland.length] = createMarker(new GPoint(-70.25189209,43.63389969),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Mahoney Middle School",'South_Portland=' + South_Portland.length);
Windham[Windham.length] = createMarker(new GPoint(-70.43544769,43.83121490),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Manchester School",'Windham=' + Windham.length);
Portland[Portland.length] = createMarker(new GPoint(-70.24471283,43.66640472),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Marada Adams School",'Portland=' + Portland.length);
South_Portland[South_Portland.length] = createMarker(new GPoint(-70.31591797,43.63512039),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Mary F. Marsh Elementary School",'South_Portland=' + South_Portland.length);
Freeport[Freeport.length] = createMarker(new GPoint(-70.09041595,43.85771179),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Mast Landing School",'Freeport=' + Freeport.length);
South_Portland[South_Portland.length] = createMarker(new GPoint(-70.30403137,43.62718582),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Memorial Middle School",'South_Portland=' + South_Portland.length);
New_Gloucester[New_Gloucester.length] = createMarker(new GPoint(-70.27995300,43.96489716),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Memorial School",'New_Gloucester=' + New_Gloucester.length);
Freeport[Freeport.length] = createMarker(new GPoint(-70.10552979,43.85831451),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Morse Street School",'Freeport=' + Freeport.length);
Gorham[Gorham.length] = createMarker(new GPoint(-70.42738342,43.68455887),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Narragansett Elementary School",'Gorham=' + Gorham.length);
Portland[Portland.length] = createMarker(new GPoint(-70.28070068,43.66036606),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Nathan Clifford School",'Portland=' + Portland.length);
N_Yarmouth[N_Yarmouth.length] = createMarker(new GPoint(-70.24584198,43.83471298),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("North Yarmouth Memorial School",'N_Yarmouth=' + N_Yarmouth.length);
Westbrook[Westbrook.length] = createMarker(new GPoint(-70.35770416,43.67059326),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Oxford-cumberland Canal School",'Westbrook=' + Westbrook.length);
Peaks_Island[Peaks_Island.length] = createMarker(new GPoint(-70.19685364,43.66075897),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Peaks Island School",'Peaks_Island=' + Peaks_Island.length);
Portland[Portland.length] = createMarker(new GPoint(-70.28218842,43.67639160),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Percival P Baxter School",'Portland=' + Portland.length);
Scarborough[Scarborough.length] = createMarker(new GPoint(-70.30004883,43.58905411),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Pleasant Hill School",'Scarborough=' + Scarborough.length);
Falmouth[Falmouth.length] = createMarker(new GPoint(-70.24475861,43.72441483),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Plummer-motz School",'Falmouth=' + Falmouth.length);
Cape_Elizabeth[Cape_Elizabeth.length] = createMarker(new GPoint(-70.23069000,43.59588242),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Pond Cove Elementary School",'Cape_Elizabeth=' + Cape_Elizabeth.length);
Portland[Portland.length] = createMarker(new GPoint(-70.29191589,43.69521713),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Portland Arts & Technology High School",'Portland=' + Portland.length);
Portland[Portland.length] = createMarker(new GPoint(-70.25889587,43.65933228),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Portland High School",'Portland=' + Portland.length);
Pownal[Pownal.length] = createMarker(new GPoint(-70.19279480,43.89641953),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Pownal Elementary School",'Pownal=' + Pownal.length);
Portland[Portland.length] = createMarker(new GPoint(-70.26020050,43.68441772),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Presumpscot School",'Portland=' + Portland.length);
Westbrook[Westbrook.length] = createMarker(new GPoint(-70.33563232,43.71128082),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Prides Corner School",'Westbrook=' + Westbrook.length);
Raymond[Raymond.length] = createMarker(new GPoint(-70.44740295,43.93774414),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Raymond Elementary School",'Raymond=' + Raymond.length);
Portland[Portland.length] = createMarker(new GPoint(-70.30743408,43.69701385),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Riverton School",'Portland=' + Portland.length);
Gray[Gray.length] = createMarker(new GPoint(-70.33144379,43.88932037),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Russell School",'Gray=' + Gray.length);
Westbrook[Westbrook.length] = createMarker(new GPoint(-70.37580872,43.67264557),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Saccarappa School",'Westbrook=' + Westbrook.length);
Scarborough[Scarborough.length] = createMarker(new GPoint(-70.33490753,43.59142685),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Scarborough High School",'Scarborough=' + Scarborough.length);
Scarborough[Scarborough.length] = createMarker(new GPoint(-70.33601379,43.59639740),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Scarborough Middle School",'Scarborough=' + Scarborough.length);
Sebago[Sebago.length] = createMarker(new GPoint(-70.63854218,43.85497284),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Sebago Elementary School",'Sebago=' + Sebago.length);
South_Portland[South_Portland.length] = createMarker(new GPoint(-70.30651855,43.62577438),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Skillin Elementary School",'South_Portland=' + South_Portland.length);
South_Portland[South_Portland.length] = createMarker(new GPoint(-70.23316193,43.64033127),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Small Elementary School",'South_Portland=' + South_Portland.length);
Naples[Naples.length] = createMarker(new GPoint(-70.57084656,43.95864487),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Songo Locks School",'Naples=' + Naples.length);
South_Portland[South_Portland.length] = createMarker(new GPoint(-70.26857758,43.62075424),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("South Portland High School",'South_Portland=' + South_Portland.length);
Steep_Falls[Steep_Falls.length] = createMarker(new GPoint(-70.63849640,43.76689911),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Steep Falls Elementary School",'Steep_Falls=' + Steep_Falls.length);
Bridgton[Bridgton.length] = createMarker(new GPoint(-70.70183563,44.05201340),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Stevens Brook School",'Bridgton=' + Bridgton.length);
Gorham[Gorham.length] = createMarker(new GPoint(-70.43767548,43.67736053),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Village Elementary School",'Gorham=' + Gorham.length);
Harpswell[Harpswell.length] = createMarker(new GPoint(-70.01473236,43.75823593),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("West Harpswell Elementary School",'Harpswell=' + Harpswell.length);
Portland[Portland.length] = createMarker(new GPoint(-70.28731537,43.65823364),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("West School",'Portland=' + Portland.length);
Westbrook[Westbrook.length] = createMarker(new GPoint(-70.35586548,43.67455673),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Westbrook High School",'Westbrook=' + Westbrook.length);
Westbrook[Westbrook.length] = createMarker(new GPoint(-70.35586548,43.67455673),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Westbrook Regional Technology Center",'Westbrook=' + Westbrook.length);
Gorham[Gorham.length] = createMarker(new GPoint(-70.47479248,43.76507950),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("White Rock School",'Gorham=' + Gorham.length);
Yarmouth[Yarmouth.length] = createMarker(new GPoint(-70.18750763,43.80176163),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("William H Rowe School",'Yarmouth=' + Yarmouth.length);
Windham[Windham.length] = createMarker(new GPoint(-70.41295624,43.78492355),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Windham High School",'Windham=' + Windham.length);
Windham[Windham.length] = createMarker(new GPoint(-70.41277313,43.78516006),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Windham Middle School",'Windham=' + Windham.length);
Windham[Windham.length] = createMarker(new GPoint(-70.41310883,43.78469849),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Windham Primary School",'Windham=' + Windham.length);
Windham[Windham.length] = createMarker(new GPoint(-70.42041779,43.73422623),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Windham Real School",'Windham=' + Windham.length);
Yarmouth[Yarmouth.length] = createMarker(new GPoint(-70.19875336,43.79506683),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Yarmouth Elementary School",'Yarmouth=' + Yarmouth.length);
Yarmouth[Yarmouth.length] = createMarker(new GPoint(-70.19650269,43.79447174),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Yarmouth High School",'Yarmouth=' + Yarmouth.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(Bridgton);
map.removeOverlays(Brunswick);
map.removeOverlays(Cape_Elizabeth);
map.removeOverlays(Casco);
map.removeOverlays(Chebeague_Island);
map.removeOverlays(Cliff_Island);
map.removeOverlays(Cumberland);
map.removeOverlays(Cumberland_Ctr);
map.removeOverlays(Falmouth);
map.removeOverlays(Freeport);
map.removeOverlays(Gorham);
map.removeOverlays(Gray);
map.removeOverlays(Harpswell);
map.removeOverlays(Harrison);
map.removeOverlays(Long_Island);
map.removeOverlays(N_Yarmouth);
map.removeOverlays(Naples);
map.removeOverlays(New_Gloucester);
map.removeOverlays(Peaks_Island);
map.removeOverlays(Portland);
map.removeOverlays(Pownal);
map.removeOverlays(Raymond);
map.removeOverlays(Scarborough);
map.removeOverlays(Sebago);
map.removeOverlays(Sebago_Lake);
map.removeOverlays(South_Portland);
map.removeOverlays(Standish);
map.removeOverlays(Steep_Falls);
map.removeOverlays(Westbrook);
map.removeOverlays(Windham);
map.removeOverlays(Yarmouth);
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(South_Portland);map.removeOverlays(Bridgton);
map.removeOverlays(Brunswick);
map.removeOverlays(Cape_Elizabeth);
map.removeOverlays(Casco);
map.removeOverlays(Chebeague_Island);
map.removeOverlays(Cliff_Island);
map.removeOverlays(Cumberland);
map.removeOverlays(Cumberland_Ctr);
map.removeOverlays(Falmouth);
map.removeOverlays(Freeport);
map.removeOverlays(Gorham);
map.removeOverlays(Gray);
map.removeOverlays(Harpswell);
map.removeOverlays(Harrison);
map.removeOverlays(Long_Island);
map.removeOverlays(N_Yarmouth);
map.removeOverlays(Naples);
map.removeOverlays(New_Gloucester);
map.removeOverlays(Peaks_Island);
map.removeOverlays(Portland);
map.removeOverlays(Pownal);
map.removeOverlays(Raymond);
map.removeOverlays(Scarborough);
map.removeOverlays(Sebago);
map.removeOverlays(Sebago_Lake);
map.removeOverlays(South_Portland);
map.removeOverlays(Standish);
map.removeOverlays(Steep_Falls);
map.removeOverlays(Westbrook);
map.removeOverlays(Windham);
map.removeOverlays(Yarmouth);
map.addOverlays(Bridgton);
centerByArray(Bridgton, false, false);
cntMarker += Bridgton.length;
map.addOverlays(Brunswick);
centerByArray(Brunswick, false, false);
cntMarker += Brunswick.length;
map.addOverlays(Cape_Elizabeth);
centerByArray(Cape_Elizabeth, false, false);
cntMarker += Cape_Elizabeth.length;
map.addOverlays(Casco);
centerByArray(Casco, false, false);
cntMarker += Casco.length;
map.addOverlays(Chebeague_Island);
centerByArray(Chebeague_Island, false, false);
cntMarker += Chebeague_Island.length;
map.addOverlays(Cliff_Island);
centerByArray(Cliff_Island, false, false);
cntMarker += Cliff_Island.length;
map.addOverlays(Cumberland);
centerByArray(Cumberland, false, false);
cntMarker += Cumberland.length;
map.addOverlays(Cumberland_Ctr);
centerByArray(Cumberland_Ctr, false, false);
cntMarker += Cumberland_Ctr.length;
map.addOverlays(Falmouth);
centerByArray(Falmouth, false, false);
cntMarker += Falmouth.length;
map.addOverlays(Freeport);
centerByArray(Freeport, false, false);
cntMarker += Freeport.length;
map.addOverlays(Gorham);
centerByArray(Gorham, false, false);
cntMarker += Gorham.length;
map.addOverlays(Gray);
centerByArray(Gray, false, false);
cntMarker += Gray.length;
map.addOverlays(Harpswell);
centerByArray(Harpswell, false, false);
cntMarker += Harpswell.length;
map.addOverlays(Harrison);
centerByArray(Harrison, false, false);
cntMarker += Harrison.length;
map.addOverlays(Long_Island);
centerByArray(Long_Island, false, false);
cntMarker += Long_Island.length;
map.addOverlays(N_Yarmouth);
centerByArray(N_Yarmouth, false, false);
cntMarker += N_Yarmouth.length;
map.addOverlays(Naples);
centerByArray(Naples, false, false);
cntMarker += Naples.length;
map.addOverlays(New_Gloucester);
centerByArray(New_Gloucester, false, false);
cntMarker += New_Gloucester.length;
map.addOverlays(Peaks_Island);
centerByArray(Peaks_Island, false, false);
cntMarker += Peaks_Island.length;
map.addOverlays(Portland);
centerByArray(Portland, false, false);
cntMarker += Portland.length;
map.addOverlays(Pownal);
centerByArray(Pownal, false, false);
cntMarker += Pownal.length;
map.addOverlays(Raymond);
centerByArray(Raymond, false, false);
cntMarker += Raymond.length;
map.addOverlays(Scarborough);
centerByArray(Scarborough, false, false);
cntMarker += Scarborough.length;
map.addOverlays(Sebago);
centerByArray(Sebago, false, false);
cntMarker += Sebago.length;
map.addOverlays(Sebago_Lake);
centerByArray(Sebago_Lake, false, false);
cntMarker += Sebago_Lake.length;
map.addOverlays(South_Portland);
centerByArray(South_Portland, false, false);
cntMarker += South_Portland.length;
map.addOverlays(Standish);
centerByArray(Standish, false, false);
cntMarker += Standish.length;
map.addOverlays(Steep_Falls);
centerByArray(Steep_Falls, false, false);
cntMarker += Steep_Falls.length;
map.addOverlays(Westbrook);
centerByArray(Westbrook, false, false);
cntMarker += Westbrook.length;
map.addOverlays(Windham);
centerByArray(Windham, false, false);
cntMarker += Windham.length;
map.addOverlays(Yarmouth);
centerByArray(Yarmouth, false, false);
cntMarker += Yarmouth.length;
centerByArray(South_Portland,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');
}
}