function addMarkers()
{
mySelect = document.getElementById('selection');
Niles = [];Benton_Harbor = [];Berrien_Center = [];Berrien_Springs = [];Bridgman = [];St_Joseph = [];Buchanan = [];Sawyer = [];Coloma = [];Eau_Claire = [];Galien = [];Riverside = [];Stevensville = [];New_Buffalo = [];New_Troy = [];Watervliet = [];Sodus = [];Three_Oaks = [];mySelect.options[mySelect.options.length] = new Option("Benton Harbor schools",'all=Benton_Harbor');
mySelect.options[mySelect.options.length] = new Option("Berrien Center schools",'all=Berrien_Center');
mySelect.options[mySelect.options.length] = new Option("Berrien Springs schools",'all=Berrien_Springs');
mySelect.options[mySelect.options.length] = new Option("Bridgman schools",'all=Bridgman');
mySelect.options[mySelect.options.length] = new Option("Buchanan schools",'all=Buchanan');
mySelect.options[mySelect.options.length] = new Option("Coloma schools",'all=Coloma');
mySelect.options[mySelect.options.length] = new Option("Eau Claire schools",'all=Eau_Claire');
mySelect.options[mySelect.options.length] = new Option("Galien schools",'all=Galien');
mySelect.options[mySelect.options.length] = new Option("New Buffalo schools",'all=New_Buffalo');
mySelect.options[mySelect.options.length] = new Option("New Troy schools",'all=New_Troy');
mySelect.options[mySelect.options.length] = new Option("Niles schools",'all=Niles');
mySelect.options[mySelect.options.length] = new Option("Riverside schools",'all=Riverside');
mySelect.options[mySelect.options.length] = new Option("Sawyer schools",'all=Sawyer');
mySelect.options[mySelect.options.length] = new Option("Sodus schools",'all=Sodus');
mySelect.options[mySelect.options.length] = new Option("St Joseph schools",'all=St_Joseph');
mySelect.options[mySelect.options.length] = new Option("Stevensville schools",'all=Stevensville');
mySelect.options[mySelect.options.length] = new Option("Three Oaks schools",'all=Three_Oaks');
mySelect.options[mySelect.options.length] = new Option("Watervliet schools",'all=Watervliet');
mySelect.options[mySelect.options.length] = new Option("---------------------------",'');
Niles[Niles.length] = createMarker(new GPoint(-86.25468445,41.79996872),"
",iconGr);
mySelect.options[mySelect.options.length] = new Option("Alternative High/new Bell",'Niles=' + Niles.length);
Niles[Niles.length] = createMarker(new GPoint(-86.28095245,41.81477356),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Ballard Elementary School",'Niles=' + Niles.length);
Niles[Niles.length] = createMarker(new GPoint(-86.25468445,41.79996872),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Bell Education Center",'Niles=' + Niles.length);
Benton_Harbor[Benton_Harbor.length] = createMarker(new GPoint(-86.46509552,42.10985184),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Benton Harbor Charter School",'Benton_Harbor=' + Benton_Harbor.length);
Benton_Harbor[Benton_Harbor.length] = createMarker(new GPoint(-86.45628357,42.10231781),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Benton Harbor High School",'Benton_Harbor=' + Benton_Harbor.length);
Berrien_Center[Berrien_Center.length] = createMarker(new GPoint(-86.30389404,41.95721817),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Berrien County Juvenile Cent",'Berrien_Center=' + Berrien_Center.length);
Berrien_Center[Berrien_Center.length] = createMarker(new GPoint(-86.31174469,41.95496368),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Berrien County Juvenile Center",'Berrien_Center=' + Berrien_Center.length);
Berrien_Springs[Berrien_Springs.length] = createMarker(new GPoint(-86.34538269,41.94323730),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Berrien Springs Alternative Education Center",'Berrien_Springs=' + Berrien_Springs.length);
Berrien_Springs[Berrien_Springs.length] = createMarker(new GPoint(-86.34538269,41.94323730),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Berrien Springs High School",'Berrien_Springs=' + Berrien_Springs.length);
Berrien_Springs[Berrien_Springs.length] = createMarker(new GPoint(-86.34538269,41.94323730),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Berrien Springs Middle School",'Berrien_Springs=' + Berrien_Springs.length);
Berrien_Springs[Berrien_Springs.length] = createMarker(new GPoint(-86.34661865,41.95141220),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Blossomland Learning Center",'Berrien_Springs=' + Berrien_Springs.length);
Benton_Harbor[Benton_Harbor.length] = createMarker(new GPoint(-86.41721344,42.10856247),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Boynton Montessori Program",'Benton_Harbor=' + Benton_Harbor.length);
Niles[Niles.length] = createMarker(new GPoint(-86.24520874,41.78240967),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Brandywine Elementary School",'Niles=' + Niles.length);
Niles[Niles.length] = createMarker(new GPoint(-86.23501587,41.79386139),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Brandywine Middle School",'Niles=' + Niles.length);
Niles[Niles.length] = createMarker(new GPoint(-86.23501587,41.79386139),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Brandywine Senior High School",'Niles=' + Niles.length);
Bridgman[Bridgman.length] = createMarker(new GPoint(-86.54321289,41.93912888),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Bridgman Alternative Educati High School",'Bridgman=' + Bridgman.length);
Bridgman[Bridgman.length] = createMarker(new GPoint(-86.54302216,41.93898392),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Bridgman Alternative Education High School",'Bridgman=' + Bridgman.length);
Bridgman[Bridgman.length] = createMarker(new GPoint(-86.54653931,41.94303513),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Bridgman Elementary School",'Bridgman=' + Bridgman.length);
Bridgman[Bridgman.length] = createMarker(new GPoint(-86.54321289,41.93912888),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Bridgman High School",'Bridgman=' + Bridgman.length);
St_Joseph[St_Joseph.length] = createMarker(new GPoint(-86.50366211,42.06579590),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Brown School",'St_Joseph=' + St_Joseph.length);
Buchanan[Buchanan.length] = createMarker(new GPoint(-86.36891937,41.82476807),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Buchanan High School",'Buchanan=' + Buchanan.length);
Buchanan[Buchanan.length] = createMarker(new GPoint(-86.37631989,41.83286285),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Buchanan Middle School",'Buchanan=' + Buchanan.length);
Benton_Harbor[Benton_Harbor.length] = createMarker(new GPoint(-86.45352100,42.10894500),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Calvin Britain Elementary School",'Benton_Harbor=' + Benton_Harbor.length);
Benton_Harbor[Benton_Harbor.length] = createMarker(new GPoint(-86.44068146,42.10587692),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Career/technical Center",'Benton_Harbor=' + Benton_Harbor.length);
Niles[Niles.length] = createMarker(new GPoint(-86.30915833,41.82756424),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Cedar Lane School",'Niles=' + Niles.length);
Sawyer[Sawyer.length] = createMarker(new GPoint(-86.60977936,41.87007904),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Chikaming Elementary School",'Sawyer=' + Sawyer.length);
St_Joseph[St_Joseph.length] = createMarker(new GPoint(-86.44484711,42.04373550),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Clarke School",'St_Joseph=' + St_Joseph.length);
Coloma[Coloma.length] = createMarker(new GPoint(-86.33300018,42.21080017),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Coloma Elementary School",'Coloma=' + Coloma.length);
Coloma[Coloma.length] = createMarker(new GPoint(-86.33300018,42.21080017),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Coloma High School",'Coloma=' + Coloma.length);
Coloma[Coloma.length] = createMarker(new GPoint(-86.33300018,42.21080017),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Coloma Junior High School",'Coloma=' + Coloma.length);
Coloma[Coloma.length] = createMarker(new GPoint(-86.33300018,42.21080017),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Coloma Middle School",'Coloma=' + Coloma.length);
Benton_Harbor[Benton_Harbor.length] = createMarker(new GPoint(-86.32800400,42.07943600),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Countryside Academy-elementary",'Benton_Harbor=' + Benton_Harbor.length);
Benton_Harbor[Benton_Harbor.length] = createMarker(new GPoint(-86.34186554,42.07936478),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Countryside Charter School",'Benton_Harbor=' + Benton_Harbor.length);
Benton_Harbor[Benton_Harbor.length] = createMarker(new GPoint(-86.45601654,42.13027191),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Creative Arts Academy",'Benton_Harbor=' + Benton_Harbor.length);
Benton_Harbor[Benton_Harbor.length] = createMarker(new GPoint(-86.44141388,42.08089447),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Creative Arts/gifted & Talented Academy",'Benton_Harbor=' + Benton_Harbor.length);
Niles[Niles.length] = createMarker(new GPoint(-86.24118805,41.83092117),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Eastside Elementary School",'Niles=' + Niles.length);
Eau_Claire[Eau_Claire.length] = createMarker(new GPoint(-86.31056976,41.98229599),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Eau Claire Middle-high School",'Eau_Claire=' + Eau_Claire.length);
Bridgman[Bridgman.length] = createMarker(new GPoint(-86.55287933,41.92644119),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("F.c. Reed Middle School",'Bridgman=' + Bridgman.length);
Benton_Harbor[Benton_Harbor.length] = createMarker(new GPoint(-86.44121552,42.08088303),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Fair Plain East Elementary S",'Benton_Harbor=' + Benton_Harbor.length);
Benton_Harbor[Benton_Harbor.length] = createMarker(new GPoint(-86.45539856,42.08696365),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Fair Plain Middle School",'Benton_Harbor=' + Benton_Harbor.length);
Benton_Harbor[Benton_Harbor.length] = createMarker(new GPoint(-86.44870100,42.09254000),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Fair Plain Northeast Elementary School",'Benton_Harbor=' + Benton_Harbor.length);
Benton_Harbor[Benton_Harbor.length] = createMarker(new GPoint(-86.41719818,42.10969925),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Fair Plain West Elementary S",'Benton_Harbor=' + Benton_Harbor.length);
Benton_Harbor[Benton_Harbor.length] = createMarker(new GPoint(-86.46554565,42.08334732),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Fair Plain West Elementary School",'Benton_Harbor=' + Benton_Harbor.length);
Galien[Galien.length] = createMarker(new GPoint(-86.49896700,41.79802500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Galien Alternative Education School",'Galien=' + Galien.length);
Galien[Galien.length] = createMarker(new GPoint(-86.49620056,41.80229950),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Galien Township Jr/sr High S",'Galien=' + Galien.length);
Galien[Galien.length] = createMarker(new GPoint(-86.49620056,41.80229950),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Galien Township Jr/sr High School",'Galien=' + Galien.length);
Benton_Harbor[Benton_Harbor.length] = createMarker(new GPoint(-86.46348572,42.09218979),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Gifted And Talented Academy",'Benton_Harbor=' + Benton_Harbor.length);
Riverside[Riverside.length] = createMarker(new GPoint(-86.38269806,42.18330002),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Hagar Township School",'Riverside=' + Riverside.length);
Stevensville[Stevensville.length] = createMarker(new GPoint(-86.46939850,42.01129913),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Hollywood Elementary School",'Stevensville=' + Stevensville.length);
Benton_Harbor[Benton_Harbor.length] = createMarker(new GPoint(-86.41674805,42.12290192),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Hull Middle School",'Benton_Harbor=' + Benton_Harbor.length);
St_Joseph[St_Joseph.length] = createMarker(new GPoint(-86.48808289,42.09327316),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Jefferson School",'St_Joseph=' + St_Joseph.length);
Benton_Harbor[Benton_Harbor.length] = createMarker(new GPoint(-86.44031525,42.10876465),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("King Elementary School",'Benton_Harbor=' + Benton_Harbor.length);
Stevensville[Stevensville.length] = createMarker(new GPoint(-86.49488068,42.01314163),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Lakeshore High School",'Stevensville=' + Stevensville.length);
Stevensville[Stevensville.length] = createMarker(new GPoint(-86.48892975,42.01444626),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Lakeshore Middle School",'Stevensville=' + Stevensville.length);
St_Joseph[St_Joseph.length] = createMarker(new GPoint(-86.48037720,42.09377670),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Lincoln School",'St_Joseph=' + St_Joseph.length);
Eau_Claire[Eau_Claire.length] = createMarker(new GPoint(-86.30707550,41.98543549),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Lybrook Elementary School",'Eau_Claire=' + Eau_Claire.length);
Berrien_Springs[Berrien_Springs.length] = createMarker(new GPoint(-86.34538269,41.94323730),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Mars Elementary School",'Berrien_Springs=' + Berrien_Springs.length);
Benton_Harbor[Benton_Harbor.length] = createMarker(new GPoint(-86.40608215,42.13593674),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Martindale Elementary School",'Benton_Harbor=' + Benton_Harbor.length);
Benton_Harbor[Benton_Harbor.length] = createMarker(new GPoint(-86.44031525,42.10963058),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Mccord Renaissance Center",'Benton_Harbor=' + Benton_Harbor.length);
Niles[Niles.length] = createMarker(new GPoint(-86.23793030,41.77843857),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Merritt Elementary School",'Niles=' + Niles.length);
Benton_Harbor[Benton_Harbor.length] = createMarker(new GPoint(-86.43690800,42.11267900),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Mildred C. Wells Preparatory Academy",'Benton_Harbor=' + Benton_Harbor.length);
Benton_Harbor[Benton_Harbor.length] = createMarker(new GPoint(-86.44049072,42.10889435),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Mlk Elementary School",'Benton_Harbor=' + Benton_Harbor.length);
Buchanan[Buchanan.length] = createMarker(new GPoint(-86.36291504,41.83203888),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Moccasin Elementary School",'Buchanan=' + Buchanan.length);
Benton_Harbor[Benton_Harbor.length] = createMarker(new GPoint(-86.44601440,42.11895370),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Morton Elementary School",'Benton_Harbor=' + Benton_Harbor.length);
New_Buffalo[New_Buffalo.length] = createMarker(new GPoint(-86.75614929,41.78329849),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("New Buffalo Elementary School",'New_Buffalo=' + New_Buffalo.length);
New_Buffalo[New_Buffalo.length] = createMarker(new GPoint(-86.72298431,41.79721451),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("New Buffalo Middle School",'New_Buffalo=' + New_Buffalo.length);
New_Buffalo[New_Buffalo.length] = createMarker(new GPoint(-86.72298431,41.79721451),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("New Buffalo Senior High School",'New_Buffalo=' + New_Buffalo.length);
New_Troy[New_Troy.length] = createMarker(new GPoint(-86.54949951,41.87749863),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("New Troy Elementary School",'New_Troy=' + New_Troy.length);
Niles[Niles.length] = createMarker(new GPoint(-86.24012756,41.83493805),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Niles Senior High School",'Niles=' + Niles.length);
Watervliet[Watervliet.length] = createMarker(new GPoint(-86.26161957,42.19770050),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("North Elementary School",'Watervliet=' + Watervliet.length);
St_Joseph[St_Joseph.length] = createMarker(new GPoint(-86.47530365,42.05897522),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("North Lincoln School",'St_Joseph=' + St_Joseph.length);
Niles[Niles.length] = createMarker(new GPoint(-86.27549744,41.82738113),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Northside Child Development Center",'Niles=' + Niles.length);
Niles[Niles.length] = createMarker(new GPoint(-86.24890137,41.84721756),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Northside Elementary School",'Niles=' + Niles.length);
Niles[Niles.length] = createMarker(new GPoint(-86.23397827,41.82379913),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Oak Manor Elementary School",'Niles=' + Niles.length);
Buchanan[Buchanan.length] = createMarker(new GPoint(-86.37328339,41.82763290),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Ottawa Elementary School",'Buchanan=' + Buchanan.length);
Coloma[Coloma.length] = createMarker(new GPoint(-86.39818573,42.19613266),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Pier School",'Coloma=' + Coloma.length);
Benton_Harbor[Benton_Harbor.length] = createMarker(new GPoint(-86.41719818,42.10969925),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Pipestone Pre-school Center",'Benton_Harbor=' + Benton_Harbor.length);
Niles[Niles.length] = createMarker(new GPoint(-86.23431396,41.83525848),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Ring Lardner Junior High School",'Niles=' + Niles.length);
Niles[Niles.length] = createMarker(new GPoint(-86.27549744,41.82738113),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Ring Lardner Middle School",'Niles=' + Niles.length);
Sodus[Sodus.length] = createMarker(new GPoint(-86.39731598,42.03750229),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("River School",'Sodus=' + Sodus.length);
Three_Oaks[Three_Oaks.length] = createMarker(new GPoint(-86.61010742,41.84045792),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("River Valley High School",'Three_Oaks=' + Three_Oaks.length);
Three_Oaks[Three_Oaks.length] = createMarker(new GPoint(-86.61010742,41.84045792),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("River Valley Middle School",'Three_Oaks=' + Three_Oaks.length);
Riverside[Riverside.length] = createMarker(new GPoint(-86.38269806,42.18330002),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Riverside School",'Riverside=' + Riverside.length);
Stevensville[Stevensville.length] = createMarker(new GPoint(-86.49851227,42.01926422),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Roosevelt Elementary School",'Stevensville=' + Stevensville.length);
St_Joseph[St_Joseph.length] = createMarker(new GPoint(-86.49261475,42.09138870),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Saint Joseph High School",'St_Joseph=' + St_Joseph.length);
Benton_Harbor[Benton_Harbor.length] = createMarker(new GPoint(-86.42649078,42.09235382),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Sorter Elementary School",'Benton_Harbor=' + Benton_Harbor.length);
Watervliet[Watervliet.length] = createMarker(new GPoint(-86.26540375,42.18336487),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("South Elementary School",'Watervliet=' + Watervliet.length);
Niles[Niles.length] = createMarker(new GPoint(-86.24090576,41.81944275),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Southside Special Educ School",'Niles=' + Niles.length);
Buchanan[Buchanan.length] = createMarker(new GPoint(-86.35218048,41.82272339),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Stark Elementary School",'Buchanan=' + Buchanan.length);
Benton_Harbor[Benton_Harbor.length] = createMarker(new GPoint(-86.44871521,42.09738541),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Sterne Brunson Elementary School",'Benton_Harbor=' + Benton_Harbor.length);
Stevensville[Stevensville.length] = createMarker(new GPoint(-86.52053070,42.04159927),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Stewart Elementary School",'Stevensville=' + Stevensville.length);
Berrien_Springs[Berrien_Springs.length] = createMarker(new GPoint(-86.34538269,41.94323730),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Sylvester Elementary School",'Berrien_Springs=' + Berrien_Springs.length);
Three_Oaks[Three_Oaks.length] = createMarker(new GPoint(-86.60928345,41.80024338),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Three Oaks Elementary School",'Three_Oaks=' + Three_Oaks.length);
St_Joseph[St_Joseph.length] = createMarker(new GPoint(-86.47282410,42.05066299),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Upton Middle School",'St_Joseph=' + St_Joseph.length);
Coloma[Coloma.length] = createMarker(new GPoint(-86.33300018,42.21080017),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Washington Elementary School",'Coloma=' + Coloma.length);
Watervliet[Watervliet.length] = createMarker(new GPoint(-86.26540375,42.18627167),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Watervliet Middle School",'Watervliet=' + Watervliet.length);
Watervliet[Watervliet.length] = createMarker(new GPoint(-86.26540375,42.18627167),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Watervliet Senior High School",'Watervliet=' + Watervliet.length);
Galien[Galien.length] = createMarker(new GPoint(-86.49620056,41.80229950),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Wolford Elementary School",'Galien=' + Galien.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(Benton_Harbor);
map.removeOverlays(Berrien_Center);
map.removeOverlays(Berrien_Springs);
map.removeOverlays(Bridgman);
map.removeOverlays(Buchanan);
map.removeOverlays(Coloma);
map.removeOverlays(Eau_Claire);
map.removeOverlays(Galien);
map.removeOverlays(New_Buffalo);
map.removeOverlays(New_Troy);
map.removeOverlays(Niles);
map.removeOverlays(Riverside);
map.removeOverlays(Sawyer);
map.removeOverlays(Sodus);
map.removeOverlays(St_Joseph);
map.removeOverlays(Stevensville);
map.removeOverlays(Three_Oaks);
map.removeOverlays(Watervliet);
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(Niles);map.removeOverlays(Benton_Harbor);
map.removeOverlays(Berrien_Center);
map.removeOverlays(Berrien_Springs);
map.removeOverlays(Bridgman);
map.removeOverlays(Buchanan);
map.removeOverlays(Coloma);
map.removeOverlays(Eau_Claire);
map.removeOverlays(Galien);
map.removeOverlays(New_Buffalo);
map.removeOverlays(New_Troy);
map.removeOverlays(Niles);
map.removeOverlays(Riverside);
map.removeOverlays(Sawyer);
map.removeOverlays(Sodus);
map.removeOverlays(St_Joseph);
map.removeOverlays(Stevensville);
map.removeOverlays(Three_Oaks);
map.removeOverlays(Watervliet);
map.addOverlays(Benton_Harbor);
centerByArray(Benton_Harbor, false, false);
cntMarker += Benton_Harbor.length;
map.addOverlays(Berrien_Center);
centerByArray(Berrien_Center, false, false);
cntMarker += Berrien_Center.length;
map.addOverlays(Berrien_Springs);
centerByArray(Berrien_Springs, false, false);
cntMarker += Berrien_Springs.length;
map.addOverlays(Bridgman);
centerByArray(Bridgman, false, false);
cntMarker += Bridgman.length;
map.addOverlays(Buchanan);
centerByArray(Buchanan, false, false);
cntMarker += Buchanan.length;
map.addOverlays(Coloma);
centerByArray(Coloma, false, false);
cntMarker += Coloma.length;
map.addOverlays(Eau_Claire);
centerByArray(Eau_Claire, false, false);
cntMarker += Eau_Claire.length;
map.addOverlays(Galien);
centerByArray(Galien, false, false);
cntMarker += Galien.length;
map.addOverlays(New_Buffalo);
centerByArray(New_Buffalo, false, false);
cntMarker += New_Buffalo.length;
map.addOverlays(New_Troy);
centerByArray(New_Troy, false, false);
cntMarker += New_Troy.length;
map.addOverlays(Niles);
centerByArray(Niles, false, false);
cntMarker += Niles.length;
map.addOverlays(Riverside);
centerByArray(Riverside, false, false);
cntMarker += Riverside.length;
map.addOverlays(Sawyer);
centerByArray(Sawyer, false, false);
cntMarker += Sawyer.length;
map.addOverlays(Sodus);
centerByArray(Sodus, false, false);
cntMarker += Sodus.length;
map.addOverlays(St_Joseph);
centerByArray(St_Joseph, false, false);
cntMarker += St_Joseph.length;
map.addOverlays(Stevensville);
centerByArray(Stevensville, false, false);
cntMarker += Stevensville.length;
map.addOverlays(Three_Oaks);
centerByArray(Three_Oaks, false, false);
cntMarker += Three_Oaks.length;
map.addOverlays(Watervliet);
centerByArray(Watervliet, false, false);
cntMarker += Watervliet.length;
centerByArray(Niles,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');
}
}