function addMarkers()
{
mySelect = document.getElementById('selection');
Trenton = [];Hamilton_Square = [];Titusville = [];Lawrenceville = [];Pennington = [];Princeton = [];Princeton_Jct = [];East_Windsor = [];Ewing = [];Hightstown = [];Hamilton = [];Hopewell = [];Plainsboro = [];Hamilton_Twp = [];Robbinsville = [];Princeton_Junction = [];Yardville = [];mySelect.options[mySelect.options.length] = new Option("East Windsor schools",'all=East_Windsor');
mySelect.options[mySelect.options.length] = new Option("Ewing schools",'all=Ewing');
mySelect.options[mySelect.options.length] = new Option("Hamilton schools",'all=Hamilton');
mySelect.options[mySelect.options.length] = new Option("Hamilton Square schools",'all=Hamilton_Square');
mySelect.options[mySelect.options.length] = new Option("Hamilton Twp schools",'all=Hamilton_Twp');
mySelect.options[mySelect.options.length] = new Option("Hightstown schools",'all=Hightstown');
mySelect.options[mySelect.options.length] = new Option("Hopewell schools",'all=Hopewell');
mySelect.options[mySelect.options.length] = new Option("Lawrenceville schools",'all=Lawrenceville');
mySelect.options[mySelect.options.length] = new Option("Pennington schools",'all=Pennington');
mySelect.options[mySelect.options.length] = new Option("Plainsboro schools",'all=Plainsboro');
mySelect.options[mySelect.options.length] = new Option("Princeton schools",'all=Princeton');
mySelect.options[mySelect.options.length] = new Option("Princeton Jct schools",'all=Princeton_Jct');
mySelect.options[mySelect.options.length] = new Option("Princeton Junction schools",'all=Princeton_Junction');
mySelect.options[mySelect.options.length] = new Option("Robbinsville schools",'all=Robbinsville');
mySelect.options[mySelect.options.length] = new Option("Titusville schools",'all=Titusville');
mySelect.options[mySelect.options.length] = new Option("Trenton schools",'all=Trenton');
mySelect.options[mySelect.options.length] = new Option("Yardville schools",'all=Yardville');
mySelect.options[mySelect.options.length] = new Option("---------------------------",'');
Trenton[Trenton.length] = createMarker(new GPoint(-74.71620178,40.19720078),"
",iconBl);
mySelect.options[mySelect.options.length] = new Option("Albert E Grice Middle School",'Trenton=' + Trenton.length);
Hamilton_Square[Hamilton_Square.length] = createMarker(new GPoint(-74.65410614,40.21959686),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Alexander Elementary School",'Hamilton_Square=' + Hamilton_Square.length);
Trenton[Trenton.length] = createMarker(new GPoint(-74.76390839,40.25100708),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Alfred Reed School",'Trenton=' + Trenton.length);
Trenton[Trenton.length] = createMarker(new GPoint(-74.79080963,40.23180771),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Arthur Holland Middle School",'Trenton=' + Trenton.length);
Titusville[Titusville.length] = createMarker(new GPoint(-74.84809875,40.30220032),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Bear Tavern Elementary School",'Titusville=' + Titusville.length);
Lawrenceville[Lawrenceville.length] = createMarker(new GPoint(-74.71841431,40.27750778),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Benjamin Franklin Elementary School",'Lawrenceville=' + Lawrenceville.length);
Trenton[Trenton.length] = createMarker(new GPoint(-74.78260040,40.24089813),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Cadwalader Elementary School",'Trenton=' + Trenton.length);
Pennington[Pennington.length] = createMarker(new GPoint(-74.78240204,40.32020187),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Central High School",'Pennington=' + Pennington.length);
Trenton[Trenton.length] = createMarker(new GPoint(-74.74600220,40.24180984),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Columbus Elementary School",'Trenton=' + Trenton.length);
Princeton[Princeton.length] = createMarker(new GPoint(-74.66286469,40.35701752),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Community Park Elementary School",'Princeton=' + Princeton.length);
Trenton[Trenton.length] = createMarker(new GPoint(-74.78121185,40.23192215),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Daylight/twilight High School",'Trenton=' + Trenton.length);
Princeton_Jct[Princeton_Jct.length] = createMarker(new GPoint(-74.61329651,40.28730011),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Dutch Neck Elementary School",'Princeton_Jct=' + Princeton_Jct.length);
Lawrenceville[Lawrenceville.length] = createMarker(new GPoint(-74.74388885,40.26264191),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Eldridge Park School",'Lawrenceville=' + Lawrenceville.length);
Trenton[Trenton.length] = createMarker(new GPoint(-74.65381900,40.22711500),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Emily C Reynolds Middle School",'Trenton=' + Trenton.length);
Trenton[Trenton.length] = createMarker(new GPoint(-74.76692963,40.22068024),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Emily Fisher Cs Of Advanced Studies",'Trenton=' + Trenton.length);
East_Windsor[East_Windsor.length] = createMarker(new GPoint(-74.52680206,40.26399994),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Ethel Mcknight Elementary School",'East_Windsor=' + East_Windsor.length);
Ewing[Ewing.length] = createMarker(new GPoint(-74.79161072,40.25421143),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Ewing High School",'Ewing=' + Ewing.length);
Ewing[Ewing.length] = createMarker(new GPoint(-74.83856201,40.27798080),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Francis Lore Elementary School",'Ewing=' + Ewing.length);
Trenton[Trenton.length] = createMarker(new GPoint(-74.74090576,40.20550919),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Franklin Elementary School",'Trenton=' + Trenton.length);
Trenton[Trenton.length] = createMarker(new GPoint(-74.72150421,40.20000839),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("George E. Wilson Elementary School",'Trenton=' + Trenton.length);
Ewing[Ewing.length] = createMarker(new GPoint(-74.79174805,40.27367783),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Gilmore J Fisher Middle School",'Ewing=' + Ewing.length);
Trenton[Trenton.length] = createMarker(new GPoint(-74.74210358,40.20150757),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Grace A Dunn Middle School",'Trenton=' + Trenton.length);
Hightstown[Hightstown.length] = createMarker(new GPoint(-74.52680206,40.26399994),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Grace Norton Rogers School",'Hightstown=' + Hightstown.length);
Trenton[Trenton.length] = createMarker(new GPoint(-74.75305939,40.22498703),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Grant Elementary School",'Trenton=' + Trenton.length);
Trenton[Trenton.length] = createMarker(new GPoint(-74.77658844,40.22357178),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Granville Charter School",'Trenton=' + Trenton.length);
Trenton[Trenton.length] = createMarker(new GPoint(-74.72422791,40.23005676),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Greenwood Elementary School",'Trenton=' + Trenton.length);
Trenton[Trenton.length] = createMarker(new GPoint(-74.77743530,40.23134232),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Gregory Elementary School",'Trenton=' + Trenton.length);
Trenton[Trenton.length] = createMarker(new GPoint(-74.68690491,40.22451019),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Hamilton East-steinert High School",'Trenton=' + Trenton.length);
Trenton[Trenton.length] = createMarker(new GPoint(-74.70812225,40.22972870),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Hamilton North-nottingham High School",'Trenton=' + Trenton.length);
Hamilton[Hamilton.length] = createMarker(new GPoint(-74.72475433,40.19778824),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Hamilton West-watson High School",'Hamilton=' + Hamilton.length);
Trenton[Trenton.length] = createMarker(new GPoint(-74.75379944,40.20800018),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Harrison Elementary School",'Trenton=' + Trenton.length);
Trenton[Trenton.length] = createMarker(new GPoint(-74.73670197,40.22180939),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Hedgepeth-williams M.s. Middle School",'Trenton=' + Trenton.length);
Hightstown[Hightstown.length] = createMarker(new GPoint(-74.52680206,40.26399994),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Hightstown High School",'Hightstown=' + Hightstown.length);
Hopewell[Hopewell.length] = createMarker(new GPoint(-74.77590179,40.39250183),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Hopewell Elementary School",'Hopewell=' + Hopewell.length);
Trenton[Trenton.length] = createMarker(new GPoint(-74.75006866,40.20519638),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("International Charter School Of Trenton",'Trenton=' + Trenton.length);
Princeton[Princeton.length] = createMarker(new GPoint(-74.65583801,40.36148071),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("J. Witherspoon Middle School",'Princeton=' + Princeton.length);
Trenton[Trenton.length] = createMarker(new GPoint(-74.75820160,40.22950745),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Jefferson Elementary School",'Trenton=' + Trenton.length);
Plainsboro[Plainsboro.length] = createMarker(new GPoint(-74.58499908,40.33179855),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("John V B Wicoff Elementary School",'Plainsboro=' + Plainsboro.length);
Princeton[Princeton.length] = createMarker(new GPoint(-74.68848300,40.34569400),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Johnson Park School",'Princeton=' + Princeton.length);
Trenton[Trenton.length] = createMarker(new GPoint(-74.66079712,40.22489929),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Joseph F Cappello School",'Trenton=' + Trenton.length);
Trenton[Trenton.length] = createMarker(new GPoint(-74.79010773,40.24030685),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Joyce Kilmer Elementary School",'Trenton=' + Trenton.length);
Trenton[Trenton.length] = createMarker(new GPoint(-74.71547699,40.18753815),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Kisthardt Elementary School",'Trenton=' + Trenton.length);
Trenton[Trenton.length] = createMarker(new GPoint(-74.71010590,40.23418045),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Klockner Elementary School",'Trenton=' + Trenton.length);
Trenton[Trenton.length] = createMarker(new GPoint(-74.72563934,40.21959305),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Kuser Elementary School",'Trenton=' + Trenton.length);
Trenton[Trenton.length] = createMarker(new GPoint(-74.71620178,40.19720078),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Lalor Elementary School",'Trenton=' + Trenton.length);
Trenton[Trenton.length] = createMarker(new GPoint(-74.67694855,40.22390747),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Langtree Elementary School",'Trenton=' + Trenton.length);
Lawrenceville[Lawrenceville.length] = createMarker(new GPoint(-74.73036957,40.26367569),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Lawrence High School",'Lawrenceville=' + Lawrenceville.length);
Lawrenceville[Lawrenceville.length] = createMarker(new GPoint(-74.74079895,40.27137756),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Lawrence Intermediate School",'Lawrenceville=' + Lawrenceville.length);
Lawrenceville[Lawrenceville.length] = createMarker(new GPoint(-74.73200226,40.26170731),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Lawrence Middle School",'Lawrenceville=' + Lawrenceville.length);
Lawrenceville[Lawrenceville.length] = createMarker(new GPoint(-74.73312378,40.29747009),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Lawrenceville Elementary School",'Lawrenceville=' + Lawrenceville.length);
Princeton[Princeton.length] = createMarker(new GPoint(-74.63930511,40.36320496),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Littlebrook School",'Princeton=' + Princeton.length);
Trenton[Trenton.length] = createMarker(new GPoint(-74.76250458,40.22450638),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Luis Munoz-rivera Elementary School",'Trenton=' + Trenton.length);
Trenton[Trenton.length] = createMarker(new GPoint(-74.75949860,40.24919891),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Martin L King Middle School",'Trenton=' + Trenton.length);
Princeton_Jct[Princeton_Jct.length] = createMarker(new GPoint(-74.61329651,40.28730011),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Maurice Hawk Elementary School",'Princeton_Jct=' + Princeton_Jct.length);
Trenton[Trenton.length] = createMarker(new GPoint(-74.70928192,40.19668579),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Mcgalliard Elementary School",'Trenton=' + Trenton.length);
Trenton[Trenton.length] = createMarker(new GPoint(-74.66079712,40.22489929),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Mcvs Assunpink Cent High School",'Trenton=' + Trenton.length);
Trenton[Trenton.length] = createMarker(new GPoint(-10.00000000,10.00000000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Mcvs Performing Arts",'Trenton=' + Trenton.length);
Pennington[Pennington.length] = createMarker(new GPoint(-74.76659100,40.28513500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Mcvs Sypek Center",'Pennington=' + Pennington.length);
East_Windsor[East_Windsor.length] = createMarker(new GPoint(-74.52680206,40.26399994),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Melvin H Kreps School",'East_Windsor=' + East_Windsor.length);
Hamilton[Hamilton.length] = createMarker(new GPoint(-74.66029400,40.24985600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Mercer Elementary School",'Hamilton=' + Hamilton.length);
Trenton[Trenton.length] = createMarker(new GPoint(-74.66079712,40.22489929),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Mercer Jr/sr High School",'Trenton=' + Trenton.length);
Trenton[Trenton.length] = createMarker(new GPoint(-74.68988800,40.23704910),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Mercerville Elementary School",'Trenton=' + Trenton.length);
Trenton[Trenton.length] = createMarker(new GPoint(-74.76777649,40.22812653),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Monument Elementary School",'Trenton=' + Trenton.length);
Trenton[Trenton.length] = createMarker(new GPoint(-74.68048096,40.24283981),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Morgan Elementary School",'Trenton=' + Trenton.length);
Trenton[Trenton.length] = createMarker(new GPoint(-74.75452423,40.20037460),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Mott Elementary School",'Trenton=' + Trenton.length);
Trenton[Trenton.length] = createMarker(new GPoint(-74.66079712,40.22489929),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("N J Reg Day-hamilton",'Trenton=' + Trenton.length);
Trenton[Trenton.length] = createMarker(new GPoint(-74.74222565,40.22471237),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("P.j. Hill Elementary School",'Trenton=' + Trenton.length);
Hamilton_Twp[Hamilton_Twp.length] = createMarker(new GPoint(-74.71343994,40.22623062),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Pace Charter School Of Hamilton",'Hamilton_Twp=' + Hamilton_Twp.length);
Trenton[Trenton.length] = createMarker(new GPoint(-74.76410675,40.20903778),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Parker Elementary School",'Trenton=' + Trenton.length);
Ewing[Ewing.length] = createMarker(new GPoint(-74.78416500,40.27511700),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Parkway",'Ewing=' + Ewing.length);
Trenton[Trenton.length] = createMarker(new GPoint(-74.73679352,40.22064590),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Paul Robeson Elementary School",'Trenton=' + Trenton.length);
East_Windsor[East_Windsor.length] = createMarker(new GPoint(-74.52680206,40.26399994),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Perry L Drew Elementary School",'East_Windsor=' + East_Windsor.length);
Robbinsville[Robbinsville.length] = createMarker(new GPoint(-74.62079620,40.23456192),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Pond Road Middle School",'Robbinsville=' + Robbinsville.length);
Princeton[Princeton.length] = createMarker(new GPoint(-74.65819550,40.36936951),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Princeton Charter School",'Princeton=' + Princeton.length);
Princeton[Princeton.length] = createMarker(new GPoint(-74.65663147,40.35684204),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Princeton High School",'Princeton=' + Princeton.length);
Trenton[Trenton.length] = createMarker(new GPoint(-74.64859772,40.20619202),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Richard C Crockett Middle School",'Trenton=' + Trenton.length);
Princeton[Princeton.length] = createMarker(new GPoint(-74.63763428,40.35425568),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Riverside Elementary School",'Princeton=' + Princeton.length);
Trenton[Trenton.length] = createMarker(new GPoint(-74.74955750,40.21615982),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Robbins Elementary School",'Trenton=' + Trenton.length);
Robbinsville[Robbinsville.length] = createMarker(new GPoint(-74.61511400,40.23728200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Robbinsville High School",'Robbinsville=' + Robbinsville.length);
Trenton[Trenton.length] = createMarker(new GPoint(-74.69551849,40.19477463),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Robinson Elementary School",'Trenton=' + Trenton.length);
Trenton[Trenton.length] = createMarker(new GPoint(-74.67135620,40.23244476),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Sayen Elementary School",'Trenton=' + Trenton.length);
Robbinsville[Robbinsville.length] = createMarker(new GPoint(-74.57836151,40.21396255),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Sharon Elementary School",'Robbinsville=' + Robbinsville.length);
Lawrenceville[Lawrenceville.length] = createMarker(new GPoint(-74.73760223,40.25510788),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Slackwood Elementary School",'Lawrenceville=' + Lawrenceville.length);
Trenton[Trenton.length] = createMarker(new GPoint(-74.78237152,40.24017715),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Stokes Elementary School",'Trenton=' + Trenton.length);
Pennington[Pennington.length] = createMarker(new GPoint(-74.76768494,40.30199051),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Stony Brook Elementary School",'Pennington=' + Pennington.length);
Trenton[Trenton.length] = createMarker(new GPoint(-74.67297363,40.18903351),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Sunnybrae Elementary School",'Trenton=' + Trenton.length);
Princeton_Junction[Princeton_Junction.length] = createMarker(new GPoint(-74.59599304,40.27298737),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Thomas R Grover Middle School",'Princeton_Junction=' + Princeton_Junction.length);
Pennington[Pennington.length] = createMarker(new GPoint(-74.78240204,40.32020187),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Timberlane Middle School",'Pennington=' + Pennington.length);
Pennington[Pennington.length] = createMarker(new GPoint(-74.79154200,40.32993100),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Toll Gate/grammar",'Pennington=' + Pennington.length);
Trenton[Trenton.length] = createMarker(new GPoint(-74.74420166,40.21850967),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Trenton Central High School",'Trenton=' + Trenton.length);
Trenton[Trenton.length] = createMarker(new GPoint(-74.77607727,40.22312927),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Trenton Community Charter School",'Trenton=' + Trenton.length);
Trenton[Trenton.length] = createMarker(new GPoint(-74.67020416,40.24490738),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Uni Hts/howard D Morrison Elementary School",'Trenton=' + Trenton.length);
Trenton[Trenton.length] = createMarker(new GPoint(-74.80783081,40.24282837),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Village Charter School",'Trenton=' + Trenton.length);
Princeton_Junction[Princeton_Junction.length] = createMarker(new GPoint(-74.61329651,40.28730011),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Village School",'Princeton_Junction=' + Princeton_Junction.length);
Hightstown[Hightstown.length] = createMarker(new GPoint(-74.52680206,40.26399994),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Walter C Black Elementary School",'Hightstown=' + Hightstown.length);
Trenton[Trenton.length] = createMarker(new GPoint(-74.74555206,40.20996094),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Washington Elementary School",'Trenton=' + Trenton.length);
Trenton[Trenton.length] = createMarker(new GPoint(-74.73306274,40.19844437),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("White Horse School",'Trenton=' + Trenton.length);
Trenton[Trenton.length] = createMarker(new GPoint(-74.74357605,40.23531723),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Wilson Elementary School",'Trenton=' + Trenton.length);
Ewing[Ewing.length] = createMarker(new GPoint(-74.76528931,40.27248764),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Wl Antheil Elementary School",'Ewing=' + Ewing.length);
Princeton_Jct[Princeton_Jct.length] = createMarker(new GPoint(-74.62100220,40.30700684),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Wwphs-south Campus High School",'Princeton_Jct=' + Princeton_Jct.length);
Trenton[Trenton.length] = createMarker(new GPoint(-74.66590118,40.17369843),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Yardville Elementary School",'Trenton=' + Trenton.length);
Yardville[Yardville.length] = createMarker(new GPoint(-74.68563080,40.18592453),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Yardville Heights Elementary School",'Yardville=' + Yardville.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(East_Windsor);
map.removeOverlays(Ewing);
map.removeOverlays(Hamilton);
map.removeOverlays(Hamilton_Square);
map.removeOverlays(Hamilton_Twp);
map.removeOverlays(Hightstown);
map.removeOverlays(Hopewell);
map.removeOverlays(Lawrenceville);
map.removeOverlays(Pennington);
map.removeOverlays(Plainsboro);
map.removeOverlays(Princeton);
map.removeOverlays(Princeton_Jct);
map.removeOverlays(Princeton_Junction);
map.removeOverlays(Robbinsville);
map.removeOverlays(Titusville);
map.removeOverlays(Trenton);
map.removeOverlays(Yardville);
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(Trenton);map.removeOverlays(East_Windsor);
map.removeOverlays(Ewing);
map.removeOverlays(Hamilton);
map.removeOverlays(Hamilton_Square);
map.removeOverlays(Hamilton_Twp);
map.removeOverlays(Hightstown);
map.removeOverlays(Hopewell);
map.removeOverlays(Lawrenceville);
map.removeOverlays(Pennington);
map.removeOverlays(Plainsboro);
map.removeOverlays(Princeton);
map.removeOverlays(Princeton_Jct);
map.removeOverlays(Princeton_Junction);
map.removeOverlays(Robbinsville);
map.removeOverlays(Titusville);
map.removeOverlays(Trenton);
map.removeOverlays(Yardville);
map.addOverlays(East_Windsor);
centerByArray(East_Windsor, false, false);
cntMarker += East_Windsor.length;
map.addOverlays(Ewing);
centerByArray(Ewing, false, false);
cntMarker += Ewing.length;
map.addOverlays(Hamilton);
centerByArray(Hamilton, false, false);
cntMarker += Hamilton.length;
map.addOverlays(Hamilton_Square);
centerByArray(Hamilton_Square, false, false);
cntMarker += Hamilton_Square.length;
map.addOverlays(Hamilton_Twp);
centerByArray(Hamilton_Twp, false, false);
cntMarker += Hamilton_Twp.length;
map.addOverlays(Hightstown);
centerByArray(Hightstown, false, false);
cntMarker += Hightstown.length;
map.addOverlays(Hopewell);
centerByArray(Hopewell, false, false);
cntMarker += Hopewell.length;
map.addOverlays(Lawrenceville);
centerByArray(Lawrenceville, false, false);
cntMarker += Lawrenceville.length;
map.addOverlays(Pennington);
centerByArray(Pennington, false, false);
cntMarker += Pennington.length;
map.addOverlays(Plainsboro);
centerByArray(Plainsboro, false, false);
cntMarker += Plainsboro.length;
map.addOverlays(Princeton);
centerByArray(Princeton, false, false);
cntMarker += Princeton.length;
map.addOverlays(Princeton_Jct);
centerByArray(Princeton_Jct, false, false);
cntMarker += Princeton_Jct.length;
map.addOverlays(Princeton_Junction);
centerByArray(Princeton_Junction, false, false);
cntMarker += Princeton_Junction.length;
map.addOverlays(Robbinsville);
centerByArray(Robbinsville, false, false);
cntMarker += Robbinsville.length;
map.addOverlays(Titusville);
centerByArray(Titusville, false, false);
cntMarker += Titusville.length;
map.addOverlays(Trenton);
centerByArray(Trenton, false, false);
cntMarker += Trenton.length;
map.addOverlays(Yardville);
centerByArray(Yardville, false, false);
cntMarker += Yardville.length;
centerByArray(Trenton,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');
}
}