function addMarkers() { mySelect = document.getElementById('selection'); Crowley = [];Rayne = [];Branch = [];Church_Point = [];Egan = [];Estherwood = [];Evangeline = [];Iota = [];Mermentau = [];Midland = [];Morse = [];mySelect.options[mySelect.options.length] = new Option("Branch schools",'all=Branch'); mySelect.options[mySelect.options.length] = new Option("Church Point schools",'all=Church_Point'); mySelect.options[mySelect.options.length] = new Option("Crowley schools",'all=Crowley'); mySelect.options[mySelect.options.length] = new Option("Egan schools",'all=Egan'); mySelect.options[mySelect.options.length] = new Option("Estherwood schools",'all=Estherwood'); mySelect.options[mySelect.options.length] = new Option("Evangeline schools",'all=Evangeline'); mySelect.options[mySelect.options.length] = new Option("Iota schools",'all=Iota'); mySelect.options[mySelect.options.length] = new Option("Mermentau schools",'all=Mermentau'); mySelect.options[mySelect.options.length] = new Option("Midland schools",'all=Midland'); mySelect.options[mySelect.options.length] = new Option("Morse schools",'all=Morse'); mySelect.options[mySelect.options.length] = new Option("Rayne schools",'all=Rayne'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Crowley[Crowley.length] = createMarker(new GPoint(-92.38265991,30.23104286),"
Acadia Parish Alternative School
2122 North Parkerson Avenue
Crowley, LA 70526

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Acadia Parish Alternative School",'Crowley=' + Crowley.length); Rayne[Rayne.length] = createMarker(new GPoint(-92.27406311,30.24526596),"
Armstrong Middle School
700 Martin Luther King Drive
Rayne, LA 70578

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Armstrong Middle School",'Rayne=' + Rayne.length); Branch[Branch.length] = createMarker(new GPoint(-92.29640198,30.36580086),"
Branch Elementary School
P O Box 450
Branch, LA 70516

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Branch Elementary School",'Branch=' + Branch.length); Rayne[Rayne.length] = createMarker(new GPoint(-92.26770020,30.24010086),"
Central Rayne Kindergarten School
507 North Polk Street
Rayne, LA 70578

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Central Rayne Kindergarten School",'Rayne=' + Rayne.length); Church_Point[Church_Point.length] = createMarker(new GPoint(-92.21038055,30.40076828),"
Church Point Elementary School
415 East Lougarre Street
Church Point, LA 70525

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Church Point Elementary School",'Church_Point=' + Church_Point.length); Church_Point[Church_Point.length] = createMarker(new GPoint(-92.21097565,30.40043259),"
Church Point High School
305 East Lougarre Street
Church Point, LA 70525

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Church Point High School",'Church_Point=' + Church_Point.length); Church_Point[Church_Point.length] = createMarker(new GPoint(-92.22350311,30.41085052),"
Church Point Middle School
340 Martin Luther King Drive
Church Point, LA 70525

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Church Point Middle School",'Church_Point=' + Church_Point.length); Crowley[Crowley.length] = createMarker(new GPoint(-92.40010834,30.25974846),"
Crowley High School
263 Hensgens Road
Crowley, LA 70526

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Crowley High School",'Crowley=' + Crowley.length); Crowley[Crowley.length] = createMarker(new GPoint(-92.37655640,30.22006798),"
Crowley Kindergarten School
1119 North Parkerson Avenue
Crowley, LA 70526

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Crowley Kindergarten School",'Crowley=' + Crowley.length); Crowley[Crowley.length] = createMarker(new GPoint(-92.38112640,30.22078133),"
Crowley Middle School
401 West Northern Avenue
Crowley, LA 70526

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Crowley Middle School",'Crowley=' + Crowley.length); Egan[Egan.length] = createMarker(new GPoint(-92.40030670,30.23642921),"
Egan Elementary School
2166 Egan Highway
Egan, LA 70531

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Egan Elementary School",'Egan=' + Egan.length); Estherwood[Estherwood.length] = createMarker(new GPoint(-92.46410370,30.18050003),"
Estherwood Elementary School
General Delivery
Estherwood, LA 70534

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Estherwood Elementary School",'Estherwood=' + Estherwood.length); Evangeline[Evangeline.length] = createMarker(new GPoint(-92.57022095,30.26543045),"
Evangeline Elementary School
1448 Old Evangeline Highway
Evangeline, LA 70537

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Evangeline Elementary School",'Evangeline=' + Evangeline.length); Iota[Iota.length] = createMarker(new GPoint(-92.49748230,30.33399963),"
Iota Elementary School
470 West Kennedy Street
Iota, LA 70543

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Iota Elementary School",'Iota=' + Iota.length); Iota[Iota.length] = createMarker(new GPoint(-92.49486542,30.32455063),"
Iota High School
456 South Fifth Street
Iota, LA 70543

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Iota High School",'Iota=' + Iota.length); Iota[Iota.length] = createMarker(new GPoint(-92.49485779,30.32466316),"
Iota Middle School
426 South Fifth Street
Iota, LA 70543

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Iota Middle School",'Iota=' + Iota.length); Rayne[Rayne.length] = createMarker(new GPoint(-92.28185272,30.22733688),"
Martin Petitjean Elementary School
4039 Crowley-rayne Highway
Rayne, LA 70578

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Martin Petitjean Elementary School",'Rayne=' + Rayne.length); Mermentau[Mermentau.length] = createMarker(new GPoint(-92.58180237,30.18860054),"
Mermentau Elementary School
P O Box 250
Mermentau, LA 70556

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mermentau Elementary School",'Mermentau=' + Mermentau.length); Midland[Midland.length] = createMarker(new GPoint(-92.49859619,30.16490173),"
Midland High School
735 South Crocker Street
Midland, LA 70559

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Midland High School",'Midland=' + Midland.length); Rayne[Rayne.length] = createMarker(new GPoint(-92.19351196,30.29816628),"
Mire Elementary School
5484 Mire Highway
Rayne, LA 70578

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mire Elementary School",'Rayne=' + Rayne.length); Morse[Morse.length] = createMarker(new GPoint(-92.49629974,30.14430046),"
Morse Elementary School
P O Box 247
Morse, LA 70559

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Morse Elementary School",'Morse=' + Morse.length); Crowley[Crowley.length] = createMarker(new GPoint(-92.38661957,30.22057533),"
North Crowley Elementary School
820 West Fifteenth Street
Crowley, LA 70526

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("North Crowley Elementary School",'Crowley=' + Crowley.length); Rayne[Rayne.length] = createMarker(new GPoint(-92.26753235,30.24785042),"
Rayne High School
1016 North Polk Street
Rayne, LA 70578

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Rayne High School",'Rayne=' + Rayne.length); Church_Point[Church_Point.length] = createMarker(new GPoint(-92.31286621,30.43911934),"
Richard Elementary School
1616 Charlene Highway
Church Point, LA 70525

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Richard Elementary School",'Church_Point=' + Church_Point.length); Crowley[Crowley.length] = createMarker(new GPoint(-92.39257050,30.20644951),"
Ross Elementary School
1809 West Hutchinson Avenue
Crowley, LA 70526

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Ross Elementary School",'Crowley=' + Crowley.length); Crowley[Crowley.length] = createMarker(new GPoint(-92.37020874,30.20219421),"
South Crowley Elementary School
1102 South Parkerson Avenue
Crowley, LA 70526

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("South Crowley Elementary School",'Crowley=' + Crowley.length); Rayne[Rayne.length] = createMarker(new GPoint(-92.26854706,30.22743225),"
South Rayne Elementary School
101 East Branche Street
Rayne, LA 70578

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("South Rayne Elementary School",'Rayne=' + Rayne.length); Iota[Iota.length] = createMarker(new GPoint(-92.51509857,30.32239914),"
Southwest Developmental Center
P O Box 218
Iota, LA 70543

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Southwest Developmental Center",'Iota=' + Iota.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(Branch); map.removeOverlays(Church_Point); map.removeOverlays(Crowley); map.removeOverlays(Egan); map.removeOverlays(Estherwood); map.removeOverlays(Evangeline); map.removeOverlays(Iota); map.removeOverlays(Mermentau); map.removeOverlays(Midland); map.removeOverlays(Morse); map.removeOverlays(Rayne); 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(Crowley);map.removeOverlays(Branch); map.removeOverlays(Church_Point); map.removeOverlays(Crowley); map.removeOverlays(Egan); map.removeOverlays(Estherwood); map.removeOverlays(Evangeline); map.removeOverlays(Iota); map.removeOverlays(Mermentau); map.removeOverlays(Midland); map.removeOverlays(Morse); map.removeOverlays(Rayne); map.addOverlays(Branch); centerByArray(Branch, false, false); cntMarker += Branch.length; map.addOverlays(Church_Point); centerByArray(Church_Point, false, false); cntMarker += Church_Point.length; map.addOverlays(Crowley); centerByArray(Crowley, false, false); cntMarker += Crowley.length; map.addOverlays(Egan); centerByArray(Egan, false, false); cntMarker += Egan.length; map.addOverlays(Estherwood); centerByArray(Estherwood, false, false); cntMarker += Estherwood.length; map.addOverlays(Evangeline); centerByArray(Evangeline, false, false); cntMarker += Evangeline.length; map.addOverlays(Iota); centerByArray(Iota, false, false); cntMarker += Iota.length; map.addOverlays(Mermentau); centerByArray(Mermentau, false, false); cntMarker += Mermentau.length; map.addOverlays(Midland); centerByArray(Midland, false, false); cntMarker += Midland.length; map.addOverlays(Morse); centerByArray(Morse, false, false); cntMarker += Morse.length; map.addOverlays(Rayne); centerByArray(Rayne, false, false); cntMarker += Rayne.length; centerByArray(Crowley,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'); } }