function addMarkers()
{
mySelect = document.getElementById('selection');
Ft_Bragg = [];Fayetteville = [];Roseboro = [];Hope_Mills = [];Fr_Bragg = [];Wade = [];Spring_Lake = [];Linden = [];Stedman = [];Fort_Bragg = [];mySelect.options[mySelect.options.length] = new Option("Fayetteville schools",'all=Fayetteville');
mySelect.options[mySelect.options.length] = new Option("Fort Bragg schools",'all=Fort_Bragg');
mySelect.options[mySelect.options.length] = new Option("Fr Bragg schools",'all=Fr_Bragg');
mySelect.options[mySelect.options.length] = new Option("Ft Bragg schools",'all=Ft_Bragg');
mySelect.options[mySelect.options.length] = new Option("Hope Mills schools",'all=Hope_Mills');
mySelect.options[mySelect.options.length] = new Option("Linden schools",'all=Linden');
mySelect.options[mySelect.options.length] = new Option("Roseboro schools",'all=Roseboro');
mySelect.options[mySelect.options.length] = new Option("Spring Lake schools",'all=Spring_Lake');
mySelect.options[mySelect.options.length] = new Option("Stedman schools",'all=Stedman');
mySelect.options[mySelect.options.length] = new Option("Wade schools",'all=Wade');
mySelect.options[mySelect.options.length] = new Option("---------------------------",'');
Ft_Bragg[Ft_Bragg.length] = createMarker(new GPoint(-78.99009705,35.14670181),"
",iconBl);
mySelect.options[mySelect.options.length] = new Option("Albritton Junior High School",'Ft_Bragg=' + Ft_Bragg.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-78.95276642,35.08349228),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Alger B Wilkins Elementary School",'Fayetteville=' + Fayetteville.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-78.90785980,35.06025314),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Alma O Easom Elementary School",'Fayetteville=' + Fayetteville.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-78.95619965,35.08330154),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Alpha Academy",'Fayetteville=' + Fayetteville.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-78.97444153,35.05033875),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Anne Chesnutt Middle School",'Fayetteville=' + Fayetteville.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-78.76689911,35.11827469),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Armstrong Elementary School",'Fayetteville=' + Fayetteville.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-78.97570038,35.02780151),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Ashley Elementary School",'Fayetteville=' + Fayetteville.length);
Roseboro[Roseboro.length] = createMarker(new GPoint(-78.51119995,34.97990036),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Beaver Dam Elementary School",'Roseboro=' + Roseboro.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-79.01091766,35.09307480),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Benjamin J Martin Elementary School",'Fayetteville=' + Fayetteville.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-79.04684448,35.06662369),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Bill Hefner Elementary School",'Fayetteville=' + Fayetteville.length);
Ft_Bragg[Ft_Bragg.length] = createMarker(new GPoint(-78.99009705,35.14670181),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Bowley Elementary School",'Ft_Bragg=' + Ft_Bragg.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-78.98467255,35.03906250),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Brentwood Elementary School",'Fayetteville=' + Fayetteville.length);
Ft_Bragg[Ft_Bragg.length] = createMarker(new GPoint(-78.99009705,35.14670181),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Butner Elementary School",'Ft_Bragg=' + Ft_Bragg.length);
Hope_Mills[Hope_Mills.length] = createMarker(new GPoint(-78.98199463,34.97539520),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("C Wayne Collier Elementary School",'Hope_Mills=' + Hope_Mills.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-78.75974274,35.03603745),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Cape Fear High School",'Fayetteville=' + Fayetteville.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-78.99553680,35.05811310),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Cliffdale Elementary School",'Fayetteville=' + Fayetteville.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-78.89841461,35.12778854),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("College Lakes Elementary School",'Fayetteville=' + Fayetteville.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-78.89369800,35.07049400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Cross Creek Early College",'Fayetteville=' + Fayetteville.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-78.94608307,35.03385162),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Cumberland Evening Academy",'Fayetteville=' + Fayetteville.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-78.97795900,35.02766000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Cumberland Health & Life Scien",'Fayetteville=' + Fayetteville.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-78.96694183,35.00168991),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Cumberland Mills Elementary School",'Fayetteville=' + Fayetteville.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-78.90355682,35.02187729),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Cumberland Road Elementary School",'Fayetteville=' + Fayetteville.length);
Fr_Bragg[Fr_Bragg.length] = createMarker(new GPoint(-78.99009705,35.14670181),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Devers Elementary School",'Fr_Bragg=' + Fr_Bragg.length);
Wade[Wade.length] = createMarker(new GPoint(-78.72805786,35.14082718),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("District No 7 Elementary School",'Wade=' + Wade.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-78.94608307,35.03385162),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Douglas Byrd High School",'Fayetteville=' + Fayetteville.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-78.94610596,35.03423309),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Douglas Byrd Middle School",'Fayetteville=' + Fayetteville.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-79.04498291,35.05180359),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("E E Miller Elementary School",'Fayetteville=' + Fayetteville.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-78.89634705,35.08296204),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("E E Smith High School",'Fayetteville=' + Fayetteville.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-78.99830627,34.99740219),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("E Melvin Honeycutt Elementary School",'Fayetteville=' + Fayetteville.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-78.76689911,35.11827469),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Eastover Central Elementary School",'Fayetteville=' + Fayetteville.length);
Hope_Mills[Hope_Mills.length] = createMarker(new GPoint(-78.93464661,34.97936630),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Ed V Baldwin Elementary School",'Hope_Mills=' + Hope_Mills.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-78.91526031,35.00446320),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Elizabeth M Cashwell Elementary School",'Fayetteville=' + Fayetteville.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-78.89762115,35.08506775),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Ferguson-easley Elementary School",'Fayetteville=' + Fayetteville.length);
Hope_Mills[Hope_Mills.length] = createMarker(new GPoint(-78.91417694,34.91993332),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Gallberry Farms Elementary School",'Hope_Mills=' + Hope_Mills.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-78.92696381,35.03601837),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Glendale Acres Elementary School",'Fayetteville=' + Fayetteville.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-78.93704200,34.98897200),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Gray's Creek Elementary School",'Fayetteville=' + Fayetteville.length);
Hope_Mills[Hope_Mills.length] = createMarker(new GPoint(-81.57410400,41.47721900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Gray's Creek High School",'Hope_Mills=' + Hope_Mills.length);
Hope_Mills[Hope_Mills.length] = createMarker(new GPoint(-81.55768000,41.47139200),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Gray's Creek Middle School",'Hope_Mills=' + Hope_Mills.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-78.88250732,35.07717896),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Hillsboro Street Elementary School",'Fayetteville=' + Fayetteville.length);
Ft_Bragg[Ft_Bragg.length] = createMarker(new GPoint(-78.99009705,35.14670181),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Holbrook Elementary School",'Ft_Bragg=' + Ft_Bragg.length);
Hope_Mills[Hope_Mills.length] = createMarker(new GPoint(-78.93878174,34.96601105),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Hope Mills Middle School",'Hope_Mills=' + Hope_Mills.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-78.88680267,35.15603256),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Howard L Hall Elementary School",'Fayetteville=' + Fayetteville.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-78.94613647,35.03471375),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Ireland Drive Middle School",'Fayetteville=' + Fayetteville.length);
Ft_Bragg[Ft_Bragg.length] = createMarker(new GPoint(-78.99009705,35.14670181),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Irwin Middle School",'Ft_Bragg=' + Ft_Bragg.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-78.96054840,35.03266144),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("J W Coon Elementary School",'Fayetteville=' + Fayetteville.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-78.76026917,34.98464584),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("J W Seabrook Elementary School",'Fayetteville=' + Fayetteville.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-79.06263733,34.99047852),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Jack Britt High School",'Fayetteville=' + Fayetteville.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-78.98660278,35.00136566),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("John R Griffin Middle School",'Fayetteville=' + Fayetteville.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-79.07782745,35.05061722),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Lake Rim Elementary School",'Fayetteville=' + Fayetteville.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-78.97549438,35.04776382),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Lewis Chapel Middle School",'Fayetteville=' + Fayetteville.length);
Spring_Lake[Spring_Lake.length] = createMarker(new GPoint(-78.97180176,35.16759872),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Lillian Black Elementary School",'Spring_Lake=' + Spring_Lake.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-78.86521149,35.16378021),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Long Hill Elementary School",'Fayetteville=' + Fayetteville.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-79.01046753,35.03676987),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Loyd E Auman Elementary School",'Fayetteville=' + Fayetteville.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-78.87812805,35.09979248),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Lucile Souders Elementary School",'Fayetteville=' + Fayetteville.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-78.87843200,35.09277600),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Luther Nick Jeralds Middle School",'Fayetteville=' + Fayetteville.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-78.75974274,35.03603745),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Mac Williams Middle School",'Fayetteville=' + Fayetteville.length);
Spring_Lake[Spring_Lake.length] = createMarker(new GPoint(-78.96624756,35.17906189),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Mae R Willams Kindergarten",'Spring_Lake=' + Spring_Lake.length);
Spring_Lake[Spring_Lake.length] = createMarker(new GPoint(-78.96806335,35.16949844),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Manchester Elementary School",'Spring_Lake=' + Spring_Lake.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-78.90334320,35.07077408),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Margaret Willis Elementary School",'Fayetteville=' + Fayetteville.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-78.94023132,35.02653503),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Mary Mcarthur Elementary School",'Fayetteville=' + Fayetteville.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-78.89412689,35.03116226),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Massey Hill Classical High School",'Fayetteville=' + Fayetteville.length);
Ft_Bragg[Ft_Bragg.length] = createMarker(new GPoint(-78.99009705,35.14670181),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Mcnair Elementary School",'Ft_Bragg=' + Ft_Bragg.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-78.96181488,35.05466843),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Montclair Elementary School",'Fayetteville=' + Fayetteville.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-78.98883057,35.07883835),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Morganton Road Elementary School",'Fayetteville=' + Fayetteville.length);
Ft_Bragg[Ft_Bragg.length] = createMarker(new GPoint(-78.99009705,35.14670181),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Murray Elementary School",'Ft_Bragg=' + Ft_Bragg.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-78.86870575,35.05134964),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Pauline Jones Elementary School",'Fayetteville=' + Fayetteville.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-78.88671875,35.15605164),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Pine Forest High School",'Fayetteville=' + Fayetteville.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-78.85770416,35.17736053),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Pine Forest Middle School",'Fayetteville=' + Fayetteville.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-78.98642731,35.08681488),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Ponderosa Elementary School",'Fayetteville=' + Fayetteville.length);
Ft_Bragg[Ft_Bragg.length] = createMarker(new GPoint(-78.99009705,35.14670181),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Pope Elementary School",'Ft_Bragg=' + Ft_Bragg.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-78.92194366,35.05069351),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("R Max Abbott Middle School",'Fayetteville=' + Fayetteville.length);
Linden[Linden.length] = createMarker(new GPoint(-78.84176636,35.21815491),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Raleigh Road Elementary School",'Linden=' + Linden.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-78.88237762,35.07936859),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Ramsey St High School Alt Program",'Fayetteville=' + Fayetteville.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-78.88237762,35.07936859),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Ramsey St Middle School Alt Program",'Fayetteville=' + Fayetteville.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-78.87784576,35.10166168),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Reid Ross Classical",'Fayetteville=' + Fayetteville.length);
Hope_Mills[Hope_Mills.length] = createMarker(new GPoint(-78.95658112,34.97223282),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Rockfish Elementary School",'Hope_Mills=' + Hope_Mills.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-79.00842285,35.03717041),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Seventy-first Classical Middle School",'Fayetteville=' + Fayetteville.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-79.00518799,35.03791046),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Seventy-first High School",'Fayetteville=' + Fayetteville.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-78.96293640,35.01832962),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Sherwood Park Elementary School",'Fayetteville=' + Fayetteville.length);
Hope_Mills[Hope_Mills.length] = createMarker(new GPoint(-78.92504120,34.97925568),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("South View High School",'Hope_Mills=' + Hope_Mills.length);
Hope_Mills[Hope_Mills.length] = createMarker(new GPoint(-78.92740631,34.98106766),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("South View Middle School",'Hope_Mills=' + Hope_Mills.length);
Spring_Lake[Spring_Lake.length] = createMarker(new GPoint(-78.96801758,35.16950226),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Spring Lake Middle School",'Spring_Lake=' + Spring_Lake.length);
Stedman[Stedman.length] = createMarker(new GPoint(-78.69640350,35.02339935),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Stedman Elementary School",'Stedman=' + Stedman.length);
Stedman[Stedman.length] = createMarker(new GPoint(-78.69338226,35.01126480),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Stedman Primary",'Stedman=' + Stedman.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-79.06263733,34.99047852),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Stoney Point Elementary School",'Fayetteville=' + Fayetteville.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-78.80287933,35.02724075),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Sunnyside Elementary School",'Fayetteville=' + Fayetteville.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-78.87593079,35.06467056),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Teresa C Berrien Elementary School",'Fayetteville=' + Fayetteville.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-78.91530609,35.06600571),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Terry Sanford High School",'Fayetteville=' + Fayetteville.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-78.92755127,35.05836487),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Vanstory Hills Elementary School",'Fayetteville=' + Fayetteville.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-78.87354279,35.03961182),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Walker-spivey",'Fayetteville=' + Fayetteville.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-78.90979767,35.12154770),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Warrenwood Elementary School",'Fayetteville=' + Fayetteville.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-78.89486900,35.01315100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Web Academy",'Fayetteville=' + Fayetteville.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-78.91308594,35.09979248),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Westarea Elementary School",'Fayetteville=' + Fayetteville.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-78.98731995,35.08387375),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Westover High School",'Fayetteville=' + Fayetteville.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-78.98731995,35.08387375),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Westover Middle School",'Fayetteville=' + Fayetteville.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-78.95523834,35.04323959),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("William H Owen Elementary School",'Fayetteville=' + Fayetteville.length);
Fort_Bragg[Fort_Bragg.length] = createMarker(new GPoint(-78.98979950,35.14509964),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("William T Brown Elementary School",'Fort_Bragg=' + Fort_Bragg.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-78.89686584,35.02994537),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Young Howard Elementary School",'Fayetteville=' + Fayetteville.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(Fayetteville);
map.removeOverlays(Fort_Bragg);
map.removeOverlays(Fr_Bragg);
map.removeOverlays(Ft_Bragg);
map.removeOverlays(Hope_Mills);
map.removeOverlays(Linden);
map.removeOverlays(Roseboro);
map.removeOverlays(Spring_Lake);
map.removeOverlays(Stedman);
map.removeOverlays(Wade);
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(Ft_Bragg);map.removeOverlays(Fayetteville);
map.removeOverlays(Fort_Bragg);
map.removeOverlays(Fr_Bragg);
map.removeOverlays(Ft_Bragg);
map.removeOverlays(Hope_Mills);
map.removeOverlays(Linden);
map.removeOverlays(Roseboro);
map.removeOverlays(Spring_Lake);
map.removeOverlays(Stedman);
map.removeOverlays(Wade);
map.addOverlays(Fayetteville);
centerByArray(Fayetteville, false, false);
cntMarker += Fayetteville.length;
map.addOverlays(Fort_Bragg);
centerByArray(Fort_Bragg, false, false);
cntMarker += Fort_Bragg.length;
map.addOverlays(Fr_Bragg);
centerByArray(Fr_Bragg, false, false);
cntMarker += Fr_Bragg.length;
map.addOverlays(Ft_Bragg);
centerByArray(Ft_Bragg, false, false);
cntMarker += Ft_Bragg.length;
map.addOverlays(Hope_Mills);
centerByArray(Hope_Mills, false, false);
cntMarker += Hope_Mills.length;
map.addOverlays(Linden);
centerByArray(Linden, false, false);
cntMarker += Linden.length;
map.addOverlays(Roseboro);
centerByArray(Roseboro, false, false);
cntMarker += Roseboro.length;
map.addOverlays(Spring_Lake);
centerByArray(Spring_Lake, false, false);
cntMarker += Spring_Lake.length;
map.addOverlays(Stedman);
centerByArray(Stedman, false, false);
cntMarker += Stedman.length;
map.addOverlays(Wade);
centerByArray(Wade, false, false);
cntMarker += Wade.length;
centerByArray(Ft_Bragg,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');
}
}