function addMarkers()
{
mySelect = document.getElementById('selection');
Lake_Charles = [];Bell_City = [];Sulphur = [];Dequincy = [];Iowa = [];Westlake = [];Starks = [];Vinton = [];mySelect.options[mySelect.options.length] = new Option("Bell City schools",'all=Bell_City');
mySelect.options[mySelect.options.length] = new Option("Dequincy schools",'all=Dequincy');
mySelect.options[mySelect.options.length] = new Option("Iowa schools",'all=Iowa');
mySelect.options[mySelect.options.length] = new Option("Lake Charles schools",'all=Lake_Charles');
mySelect.options[mySelect.options.length] = new Option("Starks schools",'all=Starks');
mySelect.options[mySelect.options.length] = new Option("Sulphur schools",'all=Sulphur');
mySelect.options[mySelect.options.length] = new Option("Vinton schools",'all=Vinton');
mySelect.options[mySelect.options.length] = new Option("Westlake schools",'all=Westlake');
mySelect.options[mySelect.options.length] = new Option("---------------------------",'');
Lake_Charles[Lake_Charles.length] = createMarker(new GPoint(-93.23487854,30.16856384),"
",iconRd);
mySelect.options[mySelect.options.length] = new Option("A. A. Nelson Elementary School",'Lake_Charles=' + Lake_Charles.length);
Lake_Charles[Lake_Charles.length] = createMarker(new GPoint(-93.24945831,30.17623711),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Alfred M. Barbe High School",'Lake_Charles=' + Lake_Charles.length);
Lake_Charles[Lake_Charles.length] = createMarker(new GPoint(-93.22425842,30.20793724),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Barbe Elementary School",'Lake_Charles=' + Lake_Charles.length);
Bell_City[Bell_City.length] = createMarker(new GPoint(-92.96266174,30.11509323),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Bell City High School",'Bell_City=' + Bell_City.length);
Lake_Charles[Lake_Charles.length] = createMarker(new GPoint(-93.20053864,30.18865585),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Brentwood Elementary School",'Lake_Charles=' + Lake_Charles.length);
Lake_Charles[Lake_Charles.length] = createMarker(new GPoint(-93.23583221,30.20573616),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Calcasieu Career Center",'Lake_Charles=' + Lake_Charles.length);
Lake_Charles[Lake_Charles.length] = createMarker(new GPoint(-93.18853760,30.22482109),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Calcasieu Pm High School",'Lake_Charles=' + Lake_Charles.length);
Lake_Charles[Lake_Charles.length] = createMarker(new GPoint(-93.22335815,30.19220352),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("College Oaks Elementary School",'Lake_Charles=' + Lake_Charles.length);
Sulphur[Sulphur.length] = createMarker(new GPoint(-93.38085937,30.24254799),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("D. S. Perkins Elementary School",'Sulphur=' + Sulphur.length);
Dequincy[Dequincy.length] = createMarker(new GPoint(-93.42833710,30.45216942),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Dequincy Elementary School",'Dequincy=' + Dequincy.length);
Dequincy[Dequincy.length] = createMarker(new GPoint(-93.44435883,30.45326233),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Dequincy High School",'Dequincy=' + Dequincy.length);
Dequincy[Dequincy.length] = createMarker(new GPoint(-93.45040894,30.45086479),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Dequincy Middle School",'Dequincy=' + Dequincy.length);
Lake_Charles[Lake_Charles.length] = createMarker(new GPoint(-93.22165680,30.16841507),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Dolby Elementary School",'Lake_Charles=' + Lake_Charles.length);
Lake_Charles[Lake_Charles.length] = createMarker(new GPoint(-93.17635345,30.24243736),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Doretha A. Combre Elementary School",'Lake_Charles=' + Lake_Charles.length);
Sulphur[Sulphur.length] = createMarker(new GPoint(-93.36762238,30.24213791),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("E. K. Key Elementary School",'Sulphur=' + Sulphur.length);
Lake_Charles[Lake_Charles.length] = createMarker(new GPoint(-93.20682526,30.17606354),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("F. K. White Middle School",'Lake_Charles=' + Lake_Charles.length);
Lake_Charles[Lake_Charles.length] = createMarker(new GPoint(-93.17974091,30.18433571),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Fairview Elementary School",'Lake_Charles=' + Lake_Charles.length);
Sulphur[Sulphur.length] = createMarker(new GPoint(-93.37724304,30.23405647),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Frasch Elementary School",'Sulphur=' + Sulphur.length);
Lake_Charles[Lake_Charles.length] = createMarker(new GPoint(-93.21040344,30.15086174),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Gillis Elementary School",'Lake_Charles=' + Lake_Charles.length);
Lake_Charles[Lake_Charles.length] = createMarker(new GPoint(-93.20565796,30.19246292),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Henry Heights Elementary School",'Lake_Charles=' + Lake_Charles.length);
Iowa[Iowa.length] = createMarker(new GPoint(-93.01699829,30.24613762),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Iowa High School",'Iowa=' + Iowa.length);
Iowa[Iowa.length] = createMarker(new GPoint(-93.01192474,30.23676300),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("J. I. Watson Middle School",'Iowa=' + Iowa.length);
Sulphur[Sulphur.length] = createMarker(new GPoint(-93.38049316,30.24814606),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Jake Drost School For Exceptional Children",'Sulphur=' + Sulphur.length);
Lake_Charles[Lake_Charles.length] = createMarker(new GPoint(-93.19284058,30.23884010),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Jessie D. Clifton Elementary School",'Lake_Charles=' + Lake_Charles.length);
Lake_Charles[Lake_Charles.length] = createMarker(new GPoint(-93.17607880,30.21303177),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("John F. Kennedy Elementary School",'Lake_Charles=' + Lake_Charles.length);
Lake_Charles[Lake_Charles.length] = createMarker(new GPoint(-93.19854736,30.23156357),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("John J. Johnson Ii, Elementary School",'Lake_Charles=' + Lake_Charles.length);
Lake_Charles[Lake_Charles.length] = createMarker(new GPoint(-93.20575714,30.19528580),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Lagrange High School",'Lake_Charles=' + Lake_Charles.length);
Lake_Charles[Lake_Charles.length] = createMarker(new GPoint(-93.20404053,30.21979141),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Lake Charles/boston High School",'Lake_Charles=' + Lake_Charles.length);
Sulphur[Sulphur.length] = createMarker(new GPoint(-93.38049316,30.24814606),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Leblanc Middle School",'Sulphur=' + Sulphur.length);
Lake_Charles[Lake_Charles.length] = createMarker(new GPoint(-93.08090210,30.27633667),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Lebleu Settlement Elementary School",'Lake_Charles=' + Lake_Charles.length);
Lake_Charles[Lake_Charles.length] = createMarker(new GPoint(-93.21398163,30.15596962),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("M. J. Kaufman Elementary School",'Lake_Charles=' + Lake_Charles.length);
Sulphur[Sulphur.length] = createMarker(new GPoint(-93.32051086,30.22706223),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Maplewood Middle School",'Sulphur=' + Sulphur.length);
Lake_Charles[Lake_Charles.length] = createMarker(new GPoint(-93.20266724,30.29876328),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Moss Bluff Elementary School",'Lake_Charles=' + Lake_Charles.length);
Lake_Charles[Lake_Charles.length] = createMarker(new GPoint(-93.22100830,30.30443764),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Moss Bluff Middle School",'Lake_Charles=' + Lake_Charles.length);
Lake_Charles[Lake_Charles.length] = createMarker(new GPoint(-93.19351959,30.20583725),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Oak Park Elementary School",'Lake_Charles=' + Lake_Charles.length);
Lake_Charles[Lake_Charles.length] = createMarker(new GPoint(-93.18914032,30.20336342),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Oak Park Middle School",'Lake_Charles=' + Lake_Charles.length);
Lake_Charles[Lake_Charles.length] = createMarker(new GPoint(-93.20404053,30.22136307),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Pearl Watson Elementary School",'Lake_Charles=' + Lake_Charles.length);
Lake_Charles[Lake_Charles.length] = createMarker(new GPoint(-93.24940491,30.18913651),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Prien Lake Elementary School",'Lake_Charles=' + Lake_Charles.length);
Lake_Charles[Lake_Charles.length] = createMarker(new GPoint(-93.20133972,30.24206352),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Ralph F. Wilson Elementary School",'Lake_Charles=' + Lake_Charles.length);
Lake_Charles[Lake_Charles.length] = createMarker(new GPoint(-93.18673706,30.25656319),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Ray D. Molo Middle Magnet School",'Lake_Charles=' + Lake_Charles.length);
Lake_Charles[Lake_Charles.length] = createMarker(new GPoint(-93.19714355,30.22908020),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Reynaud Middle School",'Lake_Charles=' + Lake_Charles.length);
Sulphur[Sulphur.length] = createMarker(new GPoint(-93.35823822,30.21917534),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Richard W. Vincent Elementary School",'Sulphur=' + Sulphur.length);
Lake_Charles[Lake_Charles.length] = createMarker(new GPoint(-93.24325562,30.17643738),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("S. J. Welsh Middle School",'Lake_Charles=' + Lake_Charles.length);
Westlake[Westlake.length] = createMarker(new GPoint(-93.25176239,30.24253654),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("S. P. Arnett Middle School",'Westlake=' + Westlake.length);
Lake_Charles[Lake_Charles.length] = createMarker(new GPoint(-93.25785828,30.16288567),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Saint John Elementary School",'Lake_Charles=' + Lake_Charles.length);
Lake_Charles[Lake_Charles.length] = createMarker(new GPoint(-93.21694946,30.22620010),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Sam Houston High School",'Lake_Charles=' + Lake_Charles.length);
Starks[Starks.length] = createMarker(new GPoint(-93.66299438,30.32170105),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Starks High School",'Starks=' + Starks.length);
Sulphur[Sulphur.length] = createMarker(new GPoint(-93.37439728,30.23266220),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Sulphur High School",'Sulphur=' + Sulphur.length);
Lake_Charles[Lake_Charles.length] = createMarker(new GPoint(-93.18504333,30.20735741),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("T. H. Watkins Elementary School",'Lake_Charles=' + Lake_Charles.length);
Lake_Charles[Lake_Charles.length] = createMarker(new GPoint(-93.21391296,30.20484352),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("T. S. Cooley Elementary Magnet School",'Lake_Charles=' + Lake_Charles.length);
Sulphur[Sulphur.length] = createMarker(new GPoint(-93.35925293,30.14806366),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Vincent Settlement Elementary School",'Sulphur=' + Sulphur.length);
Vinton[Vinton.length] = createMarker(new GPoint(-93.58335876,30.19283676),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Vinton Elementary School",'Vinton=' + Vinton.length);
Vinton[Vinton.length] = createMarker(new GPoint(-93.58287048,30.18136215),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Vinton High School",'Vinton=' + Vinton.length);
Vinton[Vinton.length] = createMarker(new GPoint(-93.58155823,30.19806290),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Vinton Middle School",'Vinton=' + Vinton.length);
Sulphur[Sulphur.length] = createMarker(new GPoint(-93.37037659,30.21853638),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("W. T. Henning Elementary School",'Sulphur=' + Sulphur.length);
Sulphur[Sulphur.length] = createMarker(new GPoint(-93.35995483,30.23123741),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("W. W. Lewis Middle School",'Sulphur=' + Sulphur.length);
Lake_Charles[Lake_Charles.length] = createMarker(new GPoint(-93.17710876,30.25171280),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Washington/marion Magnet High School",'Lake_Charles=' + Lake_Charles.length);
Westlake[Westlake.length] = createMarker(new GPoint(-93.26676178,30.25383759),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Western Heights Elementary School",'Westlake=' + Westlake.length);
Westlake[Westlake.length] = createMarker(new GPoint(-93.26255798,30.26063728),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Westlake High School",'Westlake=' + Westlake.length);
Westlake[Westlake.length] = createMarker(new GPoint(-93.25794220,30.25603676),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Westwood Elementary School",'Westlake=' + Westlake.length);
Lake_Charles[Lake_Charles.length] = createMarker(new GPoint(-93.18972500,30.23285100),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Wonderland Of Play Head Start",'Lake_Charles=' + Lake_Charles.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(Bell_City);
map.removeOverlays(Dequincy);
map.removeOverlays(Iowa);
map.removeOverlays(Lake_Charles);
map.removeOverlays(Starks);
map.removeOverlays(Sulphur);
map.removeOverlays(Vinton);
map.removeOverlays(Westlake);
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(Lake_Charles);map.removeOverlays(Bell_City);
map.removeOverlays(Dequincy);
map.removeOverlays(Iowa);
map.removeOverlays(Lake_Charles);
map.removeOverlays(Starks);
map.removeOverlays(Sulphur);
map.removeOverlays(Vinton);
map.removeOverlays(Westlake);
map.addOverlays(Bell_City);
centerByArray(Bell_City, false, false);
cntMarker += Bell_City.length;
map.addOverlays(Dequincy);
centerByArray(Dequincy, false, false);
cntMarker += Dequincy.length;
map.addOverlays(Iowa);
centerByArray(Iowa, false, false);
cntMarker += Iowa.length;
map.addOverlays(Lake_Charles);
centerByArray(Lake_Charles, false, false);
cntMarker += Lake_Charles.length;
map.addOverlays(Starks);
centerByArray(Starks, false, false);
cntMarker += Starks.length;
map.addOverlays(Sulphur);
centerByArray(Sulphur, false, false);
cntMarker += Sulphur.length;
map.addOverlays(Vinton);
centerByArray(Vinton, false, false);
cntMarker += Vinton.length;
map.addOverlays(Westlake);
centerByArray(Westlake, false, false);
cntMarker += Westlake.length;
centerByArray(Lake_Charles,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');
}
}