function addMarkers() { mySelect = document.getElementById('selection'); Kannapolis = [];Concord = [];Midland = [];Harrisburg = [];Mt_Pleasant = [];Mount_Pleasant = [];mySelect.options[mySelect.options.length] = new Option("Concord schools",'all=Concord'); mySelect.options[mySelect.options.length] = new Option("Harrisburg schools",'all=Harrisburg'); mySelect.options[mySelect.options.length] = new Option("Kannapolis schools",'all=Kannapolis'); mySelect.options[mySelect.options.length] = new Option("Midland schools",'all=Midland'); mySelect.options[mySelect.options.length] = new Option("Mount Pleasant schools",'all=Mount_Pleasant'); mySelect.options[mySelect.options.length] = new Option("Mt Pleasant schools",'all=Mt_Pleasant'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Kannapolis[Kannapolis.length] = createMarker(new GPoint(-80.61937714,35.49616241),"
A L Brown High School
415 E 1st Street
Kannapolis, NC 28083

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("A L Brown High School",'Kannapolis=' + Kannapolis.length); Concord[Concord.length] = createMarker(new GPoint(-80.56030273,35.39500046),"
A T Allen Elementary School
3801 Hwy 601 S
Concord, NC 28025

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("A T Allen Elementary School",'Concord=' + Concord.length); Midland[Midland.length] = createMarker(new GPoint(-80.52480316,35.24219894),"
Bethel Elementary School
2425 Midland Road
Midland, NC 28107

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Bethel Elementary School",'Midland=' + Midland.length); Concord[Concord.length] = createMarker(new GPoint(-80.59586334,35.43125153),"
Beverly Hills Elementary School
87 Palaside Drive Ne
Concord, NC 28025

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Beverly Hills Elementary School",'Concord=' + Concord.length); Concord[Concord.length] = createMarker(new GPoint(-83.92294400,39.71302300),"
C C Griffin Middle School
7650 Griffin''s Gate Drive
Concord, NC 28025

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("C C Griffin Middle School",'Concord=' + Concord.length); Concord[Concord.length] = createMarker(new GPoint(-80.58913422,35.41255188),"
Cabarrus Co Opportunity School
120 Marsh Avenue Nw
Concord, NC 28025

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Cabarrus Co Opportunity School",'Concord=' + Concord.length); Harrisburg[Harrisburg.length] = createMarker(new GPoint(-80.62403500,35.27769600),"
Carolina International School
8810 Hickory Ridge Road
Harrisburg, NC 28075

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Carolina International School",'Harrisburg=' + Harrisburg.length); Concord[Concord.length] = createMarker(new GPoint(-80.56030273,35.39500046),"
Central Cabarrus High School
505 Hwy 49 S
Concord, NC 28025

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Central Cabarrus High School",'Concord=' + Concord.length); Concord[Concord.length] = createMarker(new GPoint(-80.58468628,35.41112137),"
Coltrane-webb Elementary School
61 Spring St Nw
Concord, NC 28025

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Coltrane-webb Elementary School",'Concord=' + Concord.length); Concord[Concord.length] = createMarker(new GPoint(-80.58003998,35.43404770),"
Concord High School
481 Burrage Road Ne
Concord, NC 28025

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Concord High School",'Concord=' + Concord.length); Concord[Concord.length] = createMarker(new GPoint(-80.56030273,35.39500046),"
Concord Middle School
1500 Gold Rush Drive
Concord, NC 28025

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Concord Middle School",'Concord=' + Concord.length); Concord[Concord.length] = createMarker(new GPoint(-80.73039246,35.38959885),"
Cox Mill Elementary School
1450 Cox Mill Road
Concord, NC 28027

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Cox Mill Elementary School",'Concord=' + Concord.length); Kannapolis[Kannapolis.length] = createMarker(new GPoint(-80.60413361,35.47875977),"
Forest Park Elementary School
1333 Forest Park Drive
Kannapolis, NC 28083

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Forest Park Elementary School",'Kannapolis=' + Kannapolis.length); Kannapolis[Kannapolis.length] = createMarker(new GPoint(-80.64559937,35.49699020),"
Fred L Wilson Elementary School
1401 Pine Street
Kannapolis, NC 28081

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Fred L Wilson Elementary School",'Kannapolis=' + Kannapolis.length); Concord[Concord.length] = createMarker(new GPoint(-80.60512543,35.43053818),"
Harris Road Middle School
1251 Patriot Blvd
Concord, NC 28027

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Harris Road Middle School",'Concord=' + Concord.length); Harrisburg[Harrisburg.length] = createMarker(new GPoint(-80.64588165,35.31566620),"
Harrisburg Elementary School
3900 Stallings Road
Harrisburg, NC 28075

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Harrisburg Elementary School",'Harrisburg=' + Harrisburg.length); Concord[Concord.length] = createMarker(new GPoint(-80.59372711,35.36859131),"
J N Fries Middle School
133 Stonecrest Circle Sw
Concord, NC 28027

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("J N Fries Middle School",'Concord=' + Concord.length); Concord[Concord.length] = createMarker(new GPoint(-80.65923309,35.36040115),"
Jay M Robinson High School
300 Pitts School Road Sw
Concord, NC 28027

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Jay M Robinson High School",'Concord=' + Concord.length); Kannapolis[Kannapolis.length] = createMarker(new GPoint(-80.61653600,35.49255900),"
Kannapolis Interm
525 East C Street
Kannapolis, NC 28083

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Kannapolis Interm",'Kannapolis=' + Kannapolis.length); Kannapolis[Kannapolis.length] = createMarker(new GPoint(-80.61673737,35.49266052),"
Kannapolis Middle School
1445 Oakwood Avenue
Kannapolis, NC 28081

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Kannapolis Middle School",'Kannapolis=' + Kannapolis.length); Mt_Pleasant[Mt_Pleasant.length] = createMarker(new GPoint(-80.41699982,35.40140152),"
Mount Pleasant Elementary School
Po Box 368
Mt Pleasant, NC 28124

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mount Pleasant Elementary School",'Mt_Pleasant=' + Mt_Pleasant.length); Mount_Pleasant[Mount_Pleasant.length] = createMarker(new GPoint(-80.47728729,35.40914154),"
Mount Pleasant High School
700 Walker Road
Mount Pleasant, NC 28124

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mount Pleasant High School",'Mount_Pleasant=' + Mount_Pleasant.length); Mount_Pleasant[Mount_Pleasant.length] = createMarker(new GPoint(-80.41699982,35.40140152),"
Mount Pleasant Middle School
8325 Hwy 49 N
Mount Pleasant, NC 28124

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Mount Pleasant Middle School",'Mount_Pleasant=' + Mount_Pleasant.length); Concord[Concord.length] = createMarker(new GPoint(-80.66414642,35.45283508),"
Northwest Cabarrus High School
5130 Nw Cabarrus Drive
Concord, NC 28027

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Northwest Cabarrus High School",'Concord=' + Concord.length); Concord[Concord.length] = createMarker(new GPoint(-80.66396332,35.45221329),"
Northwest Cabarrus Middle School
5140 Nw Cabarrus Drive
Concord, NC 28027

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Northwest Cabarrus Middle School",'Concord=' + Concord.length); Concord[Concord.length] = createMarker(new GPoint(-80.64787500,35.34500000),"
Pitts School Road Elementary School
720 Pitts School Road Sw
Concord, NC 28027

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Pitts School Road Elementary School",'Concord=' + Concord.length); Concord[Concord.length] = createMarker(new GPoint(-80.56668091,35.39714813),"
R B Mcallister Elementary School
541 Sunnyside Drive Se
Concord, NC 28025

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("R B Mcallister Elementary School",'Concord=' + Concord.length); Concord[Concord.length] = createMarker(new GPoint(-80.59589386,35.34112167),"
Rocky River Elementary School
5454 Rocky River Road
Concord, NC 28025

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Rocky River Elementary School",'Concord=' + Concord.length); Kannapolis[Kannapolis.length] = createMarker(new GPoint(-80.61273956,35.46690369),"
Royal Oaks Elementary School
608 Dakota Street
Kannapolis, NC 28083

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Royal Oaks Elementary School",'Kannapolis=' + Kannapolis.length); Concord[Concord.length] = createMarker(new GPoint(-80.58913422,35.41255188),"
Sch For Environmtl Studies Middle School
120 Marsh Avenue Nw
Concord, NC 28025

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Sch For Environmtl Studies Middle School",'Concord=' + Concord.length); Kannapolis[Kannapolis.length] = createMarker(new GPoint(-80.64018250,35.47463989),"
Shady Brook Elementary School
903 Rogers Lake Road
Kannapolis, NC 28081

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Shady Brook Elementary School",'Kannapolis=' + Kannapolis.length); Concord[Concord.length] = createMarker(new GPoint(-80.56030273,35.39500046),"
W M Irvin Elementary School
1400 Gold Rush Drive
Concord, NC 28025

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("W M Irvin Elementary School",'Concord=' + Concord.length); Concord[Concord.length] = createMarker(new GPoint(-80.72743225,35.43998337),"
W R Odell Elementary School
1885 Odell School Road
Concord, NC 28027

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("W R Odell Elementary School",'Concord=' + Concord.length); Concord[Concord.length] = createMarker(new GPoint(-80.65092468,35.39854431),"
Weddington Hills Elementary School
4401 Weddington Road
Concord, NC 28025

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Weddington Hills Elementary School",'Concord=' + Concord.length); Concord[Concord.length] = createMarker(new GPoint(-80.65160370,35.39979935),"
Winecoff Elementary School
375 Winecoff Sch Road
Concord, NC 28027

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Winecoff Elementary School",'Concord=' + Concord.length); Concord[Concord.length] = createMarker(new GPoint(-80.62538910,35.37528992),"
Wolf Meadow Elementary School
150 Wolf Meadow Drive Sw
Concord, NC 28027

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Wolf Meadow Elementary School",'Concord=' + Concord.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(Concord); map.removeOverlays(Harrisburg); map.removeOverlays(Kannapolis); map.removeOverlays(Midland); map.removeOverlays(Mount_Pleasant); map.removeOverlays(Mt_Pleasant); 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(Kannapolis);map.removeOverlays(Concord); map.removeOverlays(Harrisburg); map.removeOverlays(Kannapolis); map.removeOverlays(Midland); map.removeOverlays(Mount_Pleasant); map.removeOverlays(Mt_Pleasant); map.addOverlays(Concord); centerByArray(Concord, false, false); cntMarker += Concord.length; map.addOverlays(Harrisburg); centerByArray(Harrisburg, false, false); cntMarker += Harrisburg.length; map.addOverlays(Kannapolis); centerByArray(Kannapolis, false, false); cntMarker += Kannapolis.length; map.addOverlays(Midland); centerByArray(Midland, false, false); cntMarker += Midland.length; map.addOverlays(Mount_Pleasant); centerByArray(Mount_Pleasant, false, false); cntMarker += Mount_Pleasant.length; map.addOverlays(Mt_Pleasant); centerByArray(Mt_Pleasant, false, false); cntMarker += Mt_Pleasant.length; centerByArray(Kannapolis,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'); } }