function addMarkers() { mySelect = document.getElementById('selection'); Gulfport = [];Biloxi = [];Olive_Branch = [];Jackson = [];Diberville = [];Gautier = [];Merigold = [];Long_Beach = [];New_Site = [];Ecru = [];Hattiesburg = [];Pascagoula = [];Pass_Christian = [];Carriere = [];Petal = [];Pontotoc = [];Poplarville = [];Tupelo = [];Senatobia = [];Minter_City = [];mySelect.options[mySelect.options.length] = new Option("Biloxi schools",'all=Biloxi'); mySelect.options[mySelect.options.length] = new Option("Carriere schools",'all=Carriere'); mySelect.options[mySelect.options.length] = new Option("Diberville schools",'all=Diberville'); mySelect.options[mySelect.options.length] = new Option("Ecru schools",'all=Ecru'); mySelect.options[mySelect.options.length] = new Option("Gautier schools",'all=Gautier'); mySelect.options[mySelect.options.length] = new Option("Gulfport schools",'all=Gulfport'); mySelect.options[mySelect.options.length] = new Option("Hattiesburg schools",'all=Hattiesburg'); mySelect.options[mySelect.options.length] = new Option("Jackson schools",'all=Jackson'); mySelect.options[mySelect.options.length] = new Option("Long Beach schools",'all=Long_Beach'); mySelect.options[mySelect.options.length] = new Option("Merigold schools",'all=Merigold'); mySelect.options[mySelect.options.length] = new Option("Minter City schools",'all=Minter_City'); mySelect.options[mySelect.options.length] = new Option("New Site schools",'all=New_Site'); mySelect.options[mySelect.options.length] = new Option("Olive Branch schools",'all=Olive_Branch'); mySelect.options[mySelect.options.length] = new Option("Pascagoula schools",'all=Pascagoula'); mySelect.options[mySelect.options.length] = new Option("Pass Christian schools",'all=Pass_Christian'); mySelect.options[mySelect.options.length] = new Option("Petal schools",'all=Petal'); mySelect.options[mySelect.options.length] = new Option("Pontotoc schools",'all=Pontotoc'); mySelect.options[mySelect.options.length] = new Option("Poplarville schools",'all=Poplarville'); mySelect.options[mySelect.options.length] = new Option("Senatobia schools",'all=Senatobia'); mySelect.options[mySelect.options.length] = new Option("Tupelo schools",'all=Tupelo'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Gulfport[Gulfport.length] = createMarker(new GPoint(-89.05283356,30.41042519),"
Bayou View Elementary School
4898 Washington Avenue
Gulfport, MS 39507

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Bayou View Elementary School",'Gulfport=' + Gulfport.length); Gulfport[Gulfport.length] = createMarker(new GPoint(-89.05437469,30.40349388),"
Bayou View Middle School
212 43rd Street
Gulfport, MS 39507

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Bayou View Middle School",'Gulfport=' + Gulfport.length); Biloxi[Biloxi.length] = createMarker(new GPoint(-88.93569946,30.46489906),"
Biloxi High School
1845 Richard Drive
Biloxi, MS 39532

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Biloxi High School",'Biloxi=' + Biloxi.length); Olive_Branch[Olive_Branch.length] = createMarker(new GPoint(-89.74583435,34.92005157),"
Center Hill Elementary School
13662 Center Hill Road
Olive Branch, MS 38654

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Center Hill Elementary School",'Olive_Branch=' + Olive_Branch.length); Jackson[Jackson.length] = createMarker(new GPoint(-90.18103027,32.30777359),"
Davis Magnet School
750 N Congress Street
Jackson, MS 39202

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Davis Magnet School",'Jackson=' + Jackson.length); Diberville[Diberville.length] = createMarker(new GPoint(-88.91259003,30.43573761),"
Diberville Elementary School
4540 Brodie Road
Diberville, MS 39540

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Diberville Elementary School",'Diberville=' + Diberville.length); Gautier[Gautier.length] = createMarker(new GPoint(-88.55780792,30.36589050),"
Gautier High School
4307 Gautiervancleave
Gautier, MS 39553

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Gautier High School",'Gautier=' + Gautier.length); Merigold[Merigold.length] = createMarker(new GPoint(-90.72592926,33.83813858),"
Hayes Cooper Center For Math Sc Tec
500 N Martin L King
Merigold, MS 38759

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hayes Cooper Center For Math Sc Tec",'Merigold=' + Merigold.length); Long_Beach[Long_Beach.length] = createMarker(new GPoint(-89.14823914,30.35509682),"
Long Beach Middle School
204 N Cleveland Avenue
Long Beach, MS 39560

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Long Beach Middle School",'Long_Beach=' + Long_Beach.length); New_Site[New_Site.length] = createMarker(new GPoint(-88.41820526,34.56423950),"
New Site High School
1020 Hwy. 4 East
New Site, MS 38859

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("New Site High School",'New_Site=' + New_Site.length); Ecru[Ecru.length] = createMarker(new GPoint(-89.02833557,34.36489868),"
North Pontotoc High School
8324 Hwy 15 North
Ecru, MS 38841

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("North Pontotoc High School",'Ecru=' + Ecru.length); Hattiesburg[Hattiesburg.length] = createMarker(new GPoint(-89.40982056,31.30563545),"
Oak Grove High School
5198 Old Highway 11
Hattiesburg, MS 39402

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Oak Grove High School",'Hattiesburg=' + Hattiesburg.length); Hattiesburg[Hattiesburg.length] = createMarker(new GPoint(-89.42527008,31.28381729),"
Oak Grove Middle School
2543 Old Highway 24
Hattiesburg, MS 39402

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Oak Grove Middle School",'Hattiesburg=' + Hattiesburg.length); Pascagoula[Pascagoula.length] = createMarker(new GPoint(-88.54708862,30.36239815),"
Pascagoula High School
1716 Tucker Street
Pascagoula, MS 39567

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Pascagoula High School",'Pascagoula=' + Pascagoula.length); Pass_Christian[Pass_Christian.length] = createMarker(new GPoint(-89.26729584,30.32036591),"
Pass Christian High School
6303 W. Wittman Road
Pass Christian, MS 39571

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Pass Christian High School",'Pass_Christian=' + Pass_Christian.length); Carriere[Carriere.length] = createMarker(new GPoint(-89.62610626,30.68319893),"
Pearl River Central Junior High School
7391 Hwy 11
Carriere, MS 39426

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Pearl River Central Junior High School",'Carriere=' + Carriere.length); Petal[Petal.length] = createMarker(new GPoint(-89.20504761,31.35029030),"
Petal High School
1145 Highway 42 E
Petal, MS 39465

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Petal High School",'Petal=' + Petal.length); Pontotoc[Pontotoc.length] = createMarker(new GPoint(-88.99987030,34.25114441),"
Pontotoc High School
140 Education Drive
Pontotoc, MS 38863

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Pontotoc High School",'Pontotoc=' + Pontotoc.length); Poplarville[Poplarville.length] = createMarker(new GPoint(-89.53150177,30.83624268),"
Poplarville Junior Senior High School
1 Hornet Drive
Poplarville, MS 39470

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Poplarville Junior Senior High School",'Poplarville=' + Poplarville.length); Jackson[Jackson.length] = createMarker(new GPoint(-90.17064667,32.32334518),"
Power Apac School
1120 Riverside Drive
Jackson, MS 39202

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Power Apac School",'Jackson=' + Jackson.length); Tupelo[Tupelo.length] = createMarker(new GPoint(-88.73510742,34.25833511),"
Rankin Elementary School
1908 Forrest Street
Tupelo, MS 38801

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Rankin Elementary School",'Tupelo=' + Tupelo.length); Senatobia[Senatobia.length] = createMarker(new GPoint(-89.96656036,34.62208176),"
Senatobia Junior Senior High School
221 Warrior Drive
Senatobia, MS 38668

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Senatobia Junior Senior High School",'Senatobia=' + Senatobia.length); Minter_City[Minter_City.length] = createMarker(new GPoint(-90.29487610,33.75281143),"
T Y Fleming School
19928 Highway 49e North
Minter City, MS 38944

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("T Y Fleming School",'Minter_City=' + Minter_City.length); map.removeOverlays(Biloxi); map.removeOverlays(Carriere); map.removeOverlays(Diberville); map.removeOverlays(Ecru); map.removeOverlays(Gautier); map.removeOverlays(Gulfport); map.removeOverlays(Hattiesburg); map.removeOverlays(Jackson); map.removeOverlays(Long_Beach); map.removeOverlays(Merigold); map.removeOverlays(Minter_City); map.removeOverlays(New_Site); map.removeOverlays(Olive_Branch); map.removeOverlays(Pascagoula); map.removeOverlays(Pass_Christian); map.removeOverlays(Petal); map.removeOverlays(Pontotoc); map.removeOverlays(Poplarville); map.removeOverlays(Senatobia); map.removeOverlays(Tupelo); setTimeout(function(){map.addOverlays(Biloxi)},1000); setTimeout(function(){map.addOverlays(Carriere)},1000); setTimeout(function(){map.addOverlays(Diberville)},1000); setTimeout(function(){map.addOverlays(Ecru)},1000); setTimeout(function(){map.addOverlays(Gautier)},1000); setTimeout(function(){map.addOverlays(Gulfport)},1000); setTimeout(function(){map.addOverlays(Hattiesburg)},1000); setTimeout(function(){map.addOverlays(Jackson)},1000); setTimeout(function(){map.addOverlays(Long_Beach)},1000); setTimeout(function(){map.addOverlays(Merigold)},1000); setTimeout(function(){map.addOverlays(Minter_City)},1000); setTimeout(function(){map.addOverlays(New_Site)},1000); setTimeout(function(){map.addOverlays(Olive_Branch)},1000); setTimeout(function(){map.addOverlays(Pascagoula)},1000); setTimeout(function(){map.addOverlays(Pass_Christian)},1000); setTimeout(function(){map.addOverlays(Petal)},1000); setTimeout(function(){map.addOverlays(Pontotoc)},1000); setTimeout(function(){map.addOverlays(Poplarville)},1000); setTimeout(function(){map.addOverlays(Senatobia)},1000); setTimeout(function(){map.addOverlays(Tupelo)},1000); maxLng = -88.41820526; maxLat = 34.92005157; minLng = -90.72592926; minLat = 30.32036591; reCenterMap(); } // 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(Biloxi); map.removeOverlays(Carriere); map.removeOverlays(Diberville); map.removeOverlays(Ecru); map.removeOverlays(Gautier); map.removeOverlays(Gulfport); map.removeOverlays(Hattiesburg); map.removeOverlays(Jackson); map.removeOverlays(Long_Beach); map.removeOverlays(Merigold); map.removeOverlays(Minter_City); map.removeOverlays(New_Site); map.removeOverlays(Olive_Branch); map.removeOverlays(Pascagoula); map.removeOverlays(Pass_Christian); map.removeOverlays(Petal); map.removeOverlays(Pontotoc); map.removeOverlays(Poplarville); map.removeOverlays(Senatobia); map.removeOverlays(Tupelo); 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(Gulfport);map.removeOverlays(Biloxi); map.removeOverlays(Carriere); map.removeOverlays(Diberville); map.removeOverlays(Ecru); map.removeOverlays(Gautier); map.removeOverlays(Gulfport); map.removeOverlays(Hattiesburg); map.removeOverlays(Jackson); map.removeOverlays(Long_Beach); map.removeOverlays(Merigold); map.removeOverlays(Minter_City); map.removeOverlays(New_Site); map.removeOverlays(Olive_Branch); map.removeOverlays(Pascagoula); map.removeOverlays(Pass_Christian); map.removeOverlays(Petal); map.removeOverlays(Pontotoc); map.removeOverlays(Poplarville); map.removeOverlays(Senatobia); map.removeOverlays(Tupelo); map.addOverlays(Biloxi); centerByArray(Biloxi, false, false); cntMarker += Biloxi.length; map.addOverlays(Carriere); centerByArray(Carriere, false, false); cntMarker += Carriere.length; map.addOverlays(Diberville); centerByArray(Diberville, false, false); cntMarker += Diberville.length; map.addOverlays(Ecru); centerByArray(Ecru, false, false); cntMarker += Ecru.length; map.addOverlays(Gautier); centerByArray(Gautier, false, false); cntMarker += Gautier.length; map.addOverlays(Gulfport); centerByArray(Gulfport, false, false); cntMarker += Gulfport.length; map.addOverlays(Hattiesburg); centerByArray(Hattiesburg, false, false); cntMarker += Hattiesburg.length; map.addOverlays(Jackson); centerByArray(Jackson, false, false); cntMarker += Jackson.length; map.addOverlays(Long_Beach); centerByArray(Long_Beach, false, false); cntMarker += Long_Beach.length; map.addOverlays(Merigold); centerByArray(Merigold, false, false); cntMarker += Merigold.length; map.addOverlays(Minter_City); centerByArray(Minter_City, false, false); cntMarker += Minter_City.length; map.addOverlays(New_Site); centerByArray(New_Site, false, false); cntMarker += New_Site.length; map.addOverlays(Olive_Branch); centerByArray(Olive_Branch, false, false); cntMarker += Olive_Branch.length; map.addOverlays(Pascagoula); centerByArray(Pascagoula, false, false); cntMarker += Pascagoula.length; map.addOverlays(Pass_Christian); centerByArray(Pass_Christian, false, false); cntMarker += Pass_Christian.length; map.addOverlays(Petal); centerByArray(Petal, false, false); cntMarker += Petal.length; map.addOverlays(Pontotoc); centerByArray(Pontotoc, false, false); cntMarker += Pontotoc.length; map.addOverlays(Poplarville); centerByArray(Poplarville, false, false); cntMarker += Poplarville.length; map.addOverlays(Senatobia); centerByArray(Senatobia, false, false); cntMarker += Senatobia.length; map.addOverlays(Tupelo); centerByArray(Tupelo, false, false); cntMarker += Tupelo.length; centerByArray(Gulfport,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///120046,45499,45467,45256,45516,45464,45472,45482,45507,45509,45558,45484,45068,97079,45202,45312,45083,45067,45219,44880,45298,93526,45628,/all'); } }