function addMarkers() { mySelect = document.getElementById('selection'); Shreveport = [];Eunice = [];Marrero = [];Franklinton = [];Houma = [];Washington = [];Port_Allen = [];mySelect.options[mySelect.options.length] = new Option("Eunice vocational schools",'all=Eunice'); mySelect.options[mySelect.options.length] = new Option("Franklinton vocational schools",'all=Franklinton'); mySelect.options[mySelect.options.length] = new Option("Houma vocational schools",'all=Houma'); mySelect.options[mySelect.options.length] = new Option("Marrero vocational schools",'all=Marrero'); mySelect.options[mySelect.options.length] = new Option("Port Allen vocational schools",'all=Port_Allen'); mySelect.options[mySelect.options.length] = new Option("Shreveport vocational schools",'all=Shreveport'); mySelect.options[mySelect.options.length] = new Option("Washington vocational schools",'all=Washington'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Shreveport[Shreveport.length] = createMarker(new GPoint(-93.77748871,32.54711914),"
Bossier Parish Technical School
2010 North Market Street
Shreveport, LA 71107

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bossier Parish Technical School",'Shreveport=' + Shreveport.length); Shreveport[Shreveport.length] = createMarker(new GPoint(-93.77165985,32.45378113),"
Caddo Career Center
5950 Union Avenue
Shreveport, LA 71108

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Caddo Career Center",'Shreveport=' + Shreveport.length); Eunice[Eunice.length] = createMarker(new GPoint(-92.42546082,30.49075317),"
Eunice Career & Technical Education Center
421 South 10th Street
Eunice, LA 70535

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Eunice Career & Technical Education Center",'Eunice=' + Eunice.length); Marrero[Marrero.length] = createMarker(new GPoint(-90.11383820,29.88872910),"
Joseph A. Cuillier Senior Career Center
1429-b Ames Boulevard
Marrero, LA 70072

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Joseph A. Cuillier Senior Career Center",'Marrero=' + Marrero.length); Franklinton[Franklinton.length] = createMarker(new GPoint(-90.14550018,30.85487938),"
Vocational Career Center
616 T. W. Barker Drive
Franklinton, LA 70438

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Vocational Career Center",'Franklinton=' + Franklinton.length); Houma[Houma.length] = createMarker(new GPoint(-90.67641449,29.56458282),"
Vocational Technical High/tvrc High School
3051 Patriot Drive
Houma, LA 70363

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Vocational Technical High/tvrc High School",'Houma=' + Houma.length); Washington[Washington.length] = createMarker(new GPoint(-92.05729675,30.68059921),"
Washington Career & Technical Education Center
P O Box 430
Washington, LA 70589

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Washington Career & Technical Education Center",'Washington=' + Washington.length); Port_Allen[Port_Allen.length] = createMarker(new GPoint(-91.25770569,30.46081543),"
West Baton Rouge Vocational Skills Center
3651 Rosedale Road
Port Allen, LA 70767

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("West Baton Rouge Vocational Skills Center",'Port_Allen=' + Port_Allen.length); maxLng = -90.11383820; maxLat = 32.54711914; minLng = -93.77748871; minLat = 29.56458282; reCenterMap(); map.removeOverlays(Eunice); map.removeOverlays(Franklinton); map.removeOverlays(Houma); map.removeOverlays(Marrero); map.removeOverlays(Port_Allen); map.removeOverlays(Shreveport); map.removeOverlays(Washington); setTimeout(function(){map.addOverlays(Eunice)},1000); setTimeout(function(){map.addOverlays(Franklinton)},1000); setTimeout(function(){map.addOverlays(Houma)},1000); setTimeout(function(){map.addOverlays(Marrero)},1000); setTimeout(function(){map.addOverlays(Port_Allen)},1000); setTimeout(function(){map.addOverlays(Shreveport)},1000); setTimeout(function(){map.addOverlays(Washington)},1000); } // 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(Eunice); map.removeOverlays(Franklinton); map.removeOverlays(Houma); map.removeOverlays(Marrero); map.removeOverlays(Port_Allen); map.removeOverlays(Shreveport); map.removeOverlays(Washington); 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(Shreveport);map.removeOverlays(Eunice); map.removeOverlays(Franklinton); map.removeOverlays(Houma); map.removeOverlays(Marrero); map.removeOverlays(Port_Allen); map.removeOverlays(Shreveport); map.removeOverlays(Washington); map.addOverlays(Eunice); centerByArray(Eunice, false, false); cntMarker += Eunice.length; map.addOverlays(Franklinton); centerByArray(Franklinton, false, false); cntMarker += Franklinton.length; map.addOverlays(Houma); centerByArray(Houma, false, false); cntMarker += Houma.length; map.addOverlays(Marrero); centerByArray(Marrero, false, false); cntMarker += Marrero.length; map.addOverlays(Port_Allen); centerByArray(Port_Allen, false, false); cntMarker += Port_Allen.length; map.addOverlays(Shreveport); centerByArray(Shreveport, false, false); cntMarker += Shreveport.length; map.addOverlays(Washington); centerByArray(Washington, false, false); cntMarker += Washington.length; centerByArray(Shreveport,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'); } }