function addMarkers()
{
mySelect = document.getElementById('selection');
Anchorage = [];Eagle_River = [];Elmendorf_Afb = [];Chugiak = [];Girdwood = [];Fort_Richardson = [];mySelect.options[mySelect.options.length] = new Option("Anchorage schools",'all=Anchorage');
mySelect.options[mySelect.options.length] = new Option("Chugiak schools",'all=Chugiak');
mySelect.options[mySelect.options.length] = new Option("Eagle River schools",'all=Eagle_River');
mySelect.options[mySelect.options.length] = new Option("Elmendorf Afb schools",'all=Elmendorf_Afb');
mySelect.options[mySelect.options.length] = new Option("Fort Richardson schools",'all=Fort_Richardson');
mySelect.options[mySelect.options.length] = new Option("Girdwood schools",'all=Girdwood');
mySelect.options[mySelect.options.length] = new Option("---------------------------",'');
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.83412170,61.14445877),"
",iconRd);
mySelect.options[mySelect.options.length] = new Option("Abbott Loop Elementary School",'Anchorage=' + Anchorage.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.82890320,61.20746613),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Airport Heights Elementary School",'Anchorage=' + Anchorage.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.79530334,61.20965576),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Alaska School For Deaf & Hard Of Hearing",'Anchorage=' + Anchorage.length);
Eagle_River[Eagle_River.length] = createMarker(new GPoint(-149.51774597,61.30042267),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Alpenglow Elementary School",'Eagle_River=' + Eagle_River.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.83032227,61.19504166),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Alternative Career Education High School",'Anchorage=' + Anchorage.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.81320190,61.20071793),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Anchorage Outreach/private High School",'Anchorage=' + Anchorage.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.91508484,61.19144821),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Aquarian Charter School",'Anchorage=' + Anchorage.length);
Elmendorf_Afb[Elmendorf_Afb.length] = createMarker(new GPoint(-149.86451721,61.23645020),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Aurora Elementary School",'Elmendorf_Afb=' + Elmendorf_Afb.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.88716600,61.21803300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Avail School",'Anchorage=' + Anchorage.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.73973083,61.18180847),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Bartlett High School",'Anchorage=' + Anchorage.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.76364136,61.19333649),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Baxter Elementary School",'Anchorage=' + Anchorage.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.93663025,61.12471390),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Bayshore Elementary School",'Anchorage=' + Anchorage.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.75260925,61.08583069),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Bear Valley Elementary School",'Anchorage=' + Anchorage.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.76080322,61.18038177),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Benson Secondary/s.e.a.r.c.h. High School",'Anchorage=' + Anchorage.length);
Eagle_River[Eagle_River.length] = createMarker(new GPoint(-149.56819153,61.32160187),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Birchwood Abc Elementary School",'Eagle_River=' + Eagle_River.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.81480408,61.20299911),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Booth Memorial Home",'Anchorage=' + Anchorage.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.84510803,61.11219025),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Bowman Elementary School",'Anchorage=' + Anchorage.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.89956665,61.15515518),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Campbell Elementary School",'Anchorage=' + Anchorage.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.89144900,61.20864900),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Central Middle School Of Science",'Anchorage=' + Anchorage.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.83381653,61.20827103),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Charter North Hospital",'Anchorage=' + Anchorage.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.74844360,61.20482635),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Chester Valley Elementary School",'Anchorage=' + Anchorage.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.93748474,61.14109039),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Chinook Elementary School",'Anchorage=' + Anchorage.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.89144900,61.21062500),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Chugach Optional Elementary School",'Anchorage=' + Anchorage.length);
Chugiak[Chugiak.length] = createMarker(new GPoint(-149.45150757,61.41040039),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Chugiak Elementary School",'Chugiak=' + Chugiak.length);
Eagle_River[Eagle_River.length] = createMarker(new GPoint(-149.50050354,61.31660080),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Chugiak High School",'Eagle_River=' + Eagle_River.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.80830383,61.22034836),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Clark Middle School",'Anchorage=' + Anchorage.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.78509521,61.19245148),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("College Gate Elementary School",'Anchorage=' + Anchorage.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.81750488,61.10260010),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Continuation School",'Anchorage=' + Anchorage.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.74079895,61.21694946),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Creekside Park Elementary School",'Anchorage=' + Anchorage.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.81750488,61.10260010),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Crossroads School",'Anchorage=' + Anchorage.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.67015076,61.25677109),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Denali Elementary School",'Anchorage=' + Anchorage.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.93174744,61.14064789),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Dimond High School",'Anchorage=' + Anchorage.length);
Eagle_River[Eagle_River.length] = createMarker(new GPoint(-82.11644745,33.56935883),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Distance Learning/corresp. Ctr.",'Eagle_River=' + Eagle_River.length);
Eagle_River[Eagle_River.length] = createMarker(new GPoint(-149.58062500,61.32288600),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Eagle Academy Charter School",'Eagle_River=' + Eagle_River.length);
Eagle_River[Eagle_River.length] = createMarker(new GPoint(-149.56959534,61.32138443),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Eagle River Elementary School",'Eagle_River=' + Eagle_River.length);
Eagle_River[Eagle_River.length] = createMarker(new GPoint(-149.57838700,61.29814000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Eagle River High School",'Eagle_River=' + Eagle_River.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.80606079,61.19832611),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("East High School",'Anchorage=' + Anchorage.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.85679626,61.20918274),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Fairview Elementary School",'Anchorage=' + Anchorage.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.87120056,61.19010544),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Family Partnership Charter School",'Anchorage=' + Anchorage.length);
Eagle_River[Eagle_River.length] = createMarker(new GPoint(-149.50050354,61.31660080),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Fire Lake Elementary School",'Eagle_River=' + Eagle_River.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.74702454,61.19963837),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Frontier Charter",'Anchorage=' + Anchorage.length);
Girdwood[Girdwood.length] = createMarker(new GPoint(-149.14700317,60.95280075),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Girdwood School",'Girdwood=' + Girdwood.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.93711853,61.15755463),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Gladys Wood Elementary School",'Anchorage=' + Anchorage.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.77458191,61.07873154),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Goldenview Middle School",'Anchorage=' + Anchorage.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.87373352,61.23104477),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Government Hill Elementary School",'Anchorage=' + Anchorage.length);
Eagle_River[Eagle_River.length] = createMarker(new GPoint(-116.77433014,47.75879288),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Gruening Middle School",'Eagle_River=' + Eagle_River.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.83393860,61.12590408),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Hanshew Middle School",'Anchorage=' + Anchorage.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.81750488,61.10260010),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Highland Tech. Charter School",'Anchorage=' + Anchorage.length);
Eagle_River[Eagle_River.length] = createMarker(new GPoint(-149.54620361,61.31453705),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Homestead Elementary School",'Eagle_River=' + Eagle_River.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.80729675,61.10993576),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Huffman Elementary School",'Anchorage=' + Anchorage.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.90809631,61.21044922),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Inlet View Elementary School",'Anchorage=' + Anchorage.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.79640198,61.13734818),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Jesse Lee Home",'Anchorage=' + Anchorage.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.80686951,61.15914917),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Kasuun Elementary School",'Anchorage=' + Anchorage.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.97071838,61.15904617),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Kincaid Elementary School",'Anchorage=' + Anchorage.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.83032227,61.19504166),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("King Career Center",'Anchorage=' + Anchorage.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.90719604,61.11260223),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Klatt Elementary School",'Anchorage=' + Anchorage.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.95228577,61.18441772),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Lake Hood Elementary School",'Anchorage=' + Anchorage.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.83824158,61.19063187),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Lake Otis Elementary School",'Anchorage=' + Anchorage.length);
Eagle_River[Eagle_River.length] = createMarker(new GPoint(-149.57339478,61.29830170),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Mckinley Heights High School",'Eagle_River=' + Eagle_River.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.83192444,61.18813324),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Mclaughlin Youth Center",'Anchorage=' + Anchorage.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.92926025,61.13008881),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Mears Middle School",'Anchorage=' + Anchorage.length);
Chugiak[Chugiak.length] = createMarker(new GPoint(-149.45150757,61.41040039),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Mirror Lake Middle School",'Chugiak=' + Chugiak.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.80639648,61.23126221),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Mountain View Elementary School",'Anchorage=' + Anchorage.length);
Elmendorf_Afb[Elmendorf_Afb.length] = createMarker(new GPoint(-149.85566711,61.23384094),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Mt. Iliamna Elementary School",'Elmendorf_Afb=' + Elmendorf_Afb.length);
Elmendorf_Afb[Elmendorf_Afb.length] = createMarker(new GPoint(-149.81977844,61.24150848),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Mt. Spurr Elementary School",'Elmendorf_Afb=' + Elmendorf_Afb.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.72250366,61.21873474),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Muldoon Elementary School",'Anchorage=' + Anchorage.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.89389038,61.19830322),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("North Star Elementary School",'Anchorage=' + Anchorage.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.80868530,61.20568085),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("North Star Hostital",'Anchorage=' + Anchorage.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.83787537,61.16624832),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Northern Lights Abc K-8 School",'Anchorage=' + Anchorage.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.92794800,61.17680359),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Northwood Elementary School",'Anchorage=' + Anchorage.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.77671814,61.20358276),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Nunaka Valley Elementary School",'Anchorage=' + Anchorage.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-10.00000000,10.00000000),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("O'malley Elementary School",'Anchorage=' + Anchorage.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.87881470,61.11259842),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Ocean View Elementary School",'Anchorage=' + Anchorage.length);
Elmendorf_Afb[Elmendorf_Afb.length] = createMarker(new GPoint(-149.79911804,61.23959732),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Orion Elementary School",'Elmendorf_Afb=' + Elmendorf_Afb.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.85604858,61.16626358),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Polaris K-12 School",'Anchorage=' + Anchorage.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.83155823,61.18790436),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Providence Heights",'Anchorage=' + Anchorage.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.76368713,61.21401978),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Ptarmigan Elementary School",'Anchorage=' + Anchorage.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.83416748,61.09636307),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Rabbit Creek Elementary School",'Anchorage=' + Anchorage.length);
Eagle_River[Eagle_River.length] = createMarker(new GPoint(-149.50190735,61.30679703),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Ravenwood Elementary School",'Eagle_River=' + Eagle_River.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.85635376,61.19504929),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Rogers Park Elementary School",'Anchorage=' + Anchorage.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.91310120,61.19815826),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Romig Middle School",'Anchorage=' + Anchorage.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.80287170,61.20216370),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Russian Jack Elementary School",'Anchorage=' + Anchorage.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.87512207,61.17000580),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("S.a.v.e. High School",'Anchorage=' + Anchorage.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.95213318,61.15258789),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Sand Lake Elementary School",'Anchorage=' + Anchorage.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.74850464,61.18551636),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Scenic Park Elementary School",'Anchorage=' + Anchorage.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.77709961,61.13739014),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Service High School",'Anchorage=' + Anchorage.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-10.00000000,10.00000000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("South Anchorage High School",'Anchorage=' + Anchorage.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.89961243,61.21855164),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Spring Hill Elementary School",'Anchorage=' + Anchorage.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.89288330,61.19784164),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Steller Secondary School",'Anchorage=' + Anchorage.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.74223328,61.19815063),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Susitna Elementary School",'Anchorage=' + Anchorage.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.86975098,61.15528107),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Taku Elementary School",'Anchorage=' + Anchorage.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.78660583,61.13734818),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Trailside Elementary School",'Anchorage=' + Anchorage.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.84967041,61.17491531),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Tudor Elementary School",'Anchorage=' + Anchorage.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.95030212,61.19522095),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Turnagain Elementary School",'Anchorage=' + Anchorage.length);
Fort_Richardson[Fort_Richardson.length] = createMarker(new GPoint(-149.67977905,61.25126648),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Ursa Major Elementary School",'Fort_Richardson=' + Fort_Richardson.length);
Fort_Richardson[Fort_Richardson.length] = createMarker(new GPoint(-149.69319153,61.24733353),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Ursa Minor Elementary School",'Fort_Richardson=' + Fort_Richardson.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.93362427,61.18965149),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Village Charter School",'Anchorage=' + Anchorage.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.83815002,61.19418716),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Wendler Middle School",'Anchorage=' + Anchorage.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.91394043,61.20069885),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("West High School",'Anchorage=' + Anchorage.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.81320190,61.20071793),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Whaley School",'Anchorage=' + Anchorage.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.82565308,61.22564316),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("William Tyson Elementary School",'Anchorage=' + Anchorage.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.79516602,61.21097946),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Williwaw Elementary School",'Anchorage=' + Anchorage.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.90270996,61.18064880),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Willow Crest Elementary School",'Anchorage=' + Anchorage.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.89201500,61.22043900),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Winterberry Charter School",'Anchorage=' + Anchorage.length);
Anchorage[Anchorage.length] = createMarker(new GPoint(-149.78613281,61.21853638),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Wonder Park Elementary School",'Anchorage=' + Anchorage.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(Anchorage);
map.removeOverlays(Chugiak);
map.removeOverlays(Eagle_River);
map.removeOverlays(Elmendorf_Afb);
map.removeOverlays(Fort_Richardson);
map.removeOverlays(Girdwood);
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(Anchorage);map.removeOverlays(Anchorage);
map.removeOverlays(Chugiak);
map.removeOverlays(Eagle_River);
map.removeOverlays(Elmendorf_Afb);
map.removeOverlays(Fort_Richardson);
map.removeOverlays(Girdwood);
map.addOverlays(Anchorage);
centerByArray(Anchorage, false, false);
cntMarker += Anchorage.length;
map.addOverlays(Chugiak);
centerByArray(Chugiak, false, false);
cntMarker += Chugiak.length;
map.addOverlays(Eagle_River);
centerByArray(Eagle_River, false, false);
cntMarker += Eagle_River.length;
map.addOverlays(Elmendorf_Afb);
centerByArray(Elmendorf_Afb, false, false);
cntMarker += Elmendorf_Afb.length;
map.addOverlays(Fort_Richardson);
centerByArray(Fort_Richardson, false, false);
cntMarker += Fort_Richardson.length;
map.addOverlays(Girdwood);
centerByArray(Girdwood, false, false);
cntMarker += Girdwood.length;
centerByArray(Anchorage,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');
}
}