function addMarkers(){
mySelect = document.getElementById('selection');
Graniteville = [];Sumter = [];Denmark = [];Florence = [];Anderson = [];Myrtle_Beach = [];Greenville = [];Conway = [];West_Columbia = [];Cheraw = [];Orangeburg = [];Greenwood = [];Columbia = [];Spartanburg = [];Beaufort = [];Pendleton = [];Charleston = [];Bluffton = [];Lancaster = [];Allendale = [];Union = [];Kingstree = [];Rock_Hill = [];mySelect.options[mySelect.options.length] = new Option("Allendale Schools",'all=Allendale');
mySelect.options[mySelect.options.length] = new Option("Anderson Schools",'all=Anderson');
mySelect.options[mySelect.options.length] = new Option("Beaufort Schools",'all=Beaufort');
mySelect.options[mySelect.options.length] = new Option("Bluffton Schools",'all=Bluffton');
mySelect.options[mySelect.options.length] = new Option("Charleston Schools",'all=Charleston');
mySelect.options[mySelect.options.length] = new Option("Cheraw Schools",'all=Cheraw');
mySelect.options[mySelect.options.length] = new Option("Columbia Schools",'all=Columbia');
mySelect.options[mySelect.options.length] = new Option("Conway Schools",'all=Conway');
mySelect.options[mySelect.options.length] = new Option("Denmark Schools",'all=Denmark');
mySelect.options[mySelect.options.length] = new Option("Florence Schools",'all=Florence');
mySelect.options[mySelect.options.length] = new Option("Graniteville Schools",'all=Graniteville');
mySelect.options[mySelect.options.length] = new Option("Greenville Schools",'all=Greenville');
mySelect.options[mySelect.options.length] = new Option("Greenwood Schools",'all=Greenwood');
mySelect.options[mySelect.options.length] = new Option("Kingstree Schools",'all=Kingstree');
mySelect.options[mySelect.options.length] = new Option("Lancaster Schools",'all=Lancaster');
mySelect.options[mySelect.options.length] = new Option("Myrtle Beach Schools",'all=Myrtle_Beach');
mySelect.options[mySelect.options.length] = new Option("Orangeburg Schools",'all=Orangeburg');
mySelect.options[mySelect.options.length] = new Option("Pendleton Schools",'all=Pendleton');
mySelect.options[mySelect.options.length] = new Option("Rock Hill Schools",'all=Rock_Hill');
mySelect.options[mySelect.options.length] = new Option("Spartanburg Schools",'all=Spartanburg');
mySelect.options[mySelect.options.length] = new Option("Sumter Schools",'all=Sumter');
mySelect.options[mySelect.options.length] = new Option("Union Schools",'all=Union');
mySelect.options[mySelect.options.length] = new Option("West Columbia Schools",'all=West_Columbia');
mySelect.options[mySelect.options.length] = new Option("---------------------------",'');
var tmpLatLng=0;
var tmpLen=0;
tmpLatLng=new GLatLng(33.53301700000000096,-81.8396929999999969);
tmpLen=Graniteville.length;
Graniteville[tmpLen] = createMarker(tmpLatLng,"
",iconGr);
Graniteville[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Aiken Technical College",'Graniteville=' + Graniteville.length);
tmpLatLng=new GLatLng(33.93352099999999893,-80.3696110000000061);
tmpLen=Sumter.length;
Sumter[tmpLen] = createMarker(tmpLatLng,"",iconGr);
Sumter[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Central Carolina Technical College",'Sumter=' + Sumter.length);
tmpLatLng=new GLatLng(33.31058000000000163,-81.1294199999999960);
tmpLen=Denmark.length;
Denmark[tmpLen] = createMarker(tmpLatLng,"",iconGr);
Denmark[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Denmark Technical College",'Denmark=' + Denmark.length);
tmpLatLng=new GLatLng(34.24411599999999822,-79.8177510000000012);
tmpLen=Florence.length;
Florence[tmpLen] = createMarker(tmpLatLng,"",iconGr);
Florence[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Florence-darlington Technical College",'Florence=' + Florence.length);
tmpLatLng=new GLatLng(34.49905600000000305,-82.6413550000000043);
tmpLen=Anderson.length;
Anderson[tmpLen] = createMarker(tmpLatLng,"",iconRd);
Anderson[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Forrest Junior College",'Anderson=' + Anderson.length);
tmpLatLng=new GLatLng(33.57211900000000071,-79.0031050000000050);
tmpLen=Myrtle_Beach.length;
Myrtle_Beach[tmpLen] = createMarker(tmpLatLng,"",iconRd);
Myrtle_Beach[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Golf Academy Of Carolinas",'Myrtle_Beach=' + Myrtle_Beach.length);
tmpLatLng=new GLatLng(34.83000599999999735,-82.3699990000000070);
tmpLen=Greenville.length;
Greenville[tmpLen] = createMarker(tmpLatLng,"",iconGr);
Greenville[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Greenville Technical College",'Greenville=' + Greenville.length);
tmpLatLng=new GLatLng(33.84245399999999648,-79.0603969999999947);
tmpLen=Conway.length;
Conway[tmpLen] = createMarker(tmpLatLng,"",iconGr);
Conway[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Horry-georgetown Technical College",'Conway=' + Conway.length);
tmpLatLng=new GLatLng(34.84480099999999680,-82.3199860000000001);
tmpLen=Greenville.length;
Greenville[tmpLen] = createMarker(tmpLatLng,"",iconRd);
Greenville[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Itt Technical Institute-greenville",'Greenville=' + Greenville.length);
tmpLatLng=new GLatLng(33.95212899999999933,-81.1158300000000025);
tmpLen=West_Columbia.length;
West_Columbia[tmpLen] = createMarker(tmpLatLng,"",iconGr);
West_Columbia[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Midlands Technical College",'West_Columbia=' + West_Columbia.length);
tmpLatLng=new GLatLng(34.69990299999999905,-79.9347070000000030);
tmpLen=Cheraw.length;
Cheraw[tmpLen] = createMarker(tmpLatLng,"",iconGr);
Cheraw[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Northeastern Technical College",'Cheraw=' + Cheraw.length);
tmpLatLng=new GLatLng(33.553288000000002,-80.8266590000000064);
tmpLen=Orangeburg.length;
Orangeburg[tmpLen] = createMarker(tmpLatLng,"",iconGr);
Orangeburg[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Orangeburg Calhoun Technical College",'Orangeburg=' + Orangeburg.length);
tmpLatLng=new GLatLng(34.20894599999999741,-82.1186340000000001);
tmpLen=Greenwood.length;
Greenwood[tmpLen] = createMarker(tmpLatLng,"",iconGr);
Greenwood[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Piedmont Technical College",'Greenwood=' + Greenwood.length);
tmpLatLng=new GLatLng(34.03837200000000251,-81.0410049999999984);
tmpLen=Columbia.length;
Columbia[tmpLen] = createMarker(tmpLatLng,"",iconRd);
Columbia[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("South University",'Columbia=' + Columbia.length);
tmpLatLng=new GLatLng(34.95561699999999660,-81.9695849999999950);
tmpLen=Spartanburg.length;
Spartanburg[tmpLen] = createMarker(tmpLatLng,"",iconRd);
Spartanburg[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Spartanburg Methodist College",'Spartanburg=' + Spartanburg.length);
tmpLatLng=new GLatLng(34.94929900000000344,-81.9323499999999995);
tmpLen=Spartanburg.length;
Spartanburg[tmpLen] = createMarker(tmpLatLng,"",iconGr);
Spartanburg[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Spartanburg Technical College",'Spartanburg=' + Spartanburg.length);
tmpLatLng=new GLatLng(32.4317089999999979,-80.6699299999999936);
tmpLen=Beaufort.length;
Beaufort[tmpLen] = createMarker(tmpLatLng,"",iconGr);
Beaufort[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Technical College Of Lowcountry",'Beaufort=' + Beaufort.length);
tmpLatLng=new GLatLng(34.65182099999999820,-82.7838359999999937);
tmpLen=Pendleton.length;
Pendleton[tmpLen] = createMarker(tmpLatLng,"",iconGr);
Pendleton[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Tri-county Technical College",'Pendleton=' + Pendleton.length);
tmpLatLng=new GLatLng(32.87876599999999882,-80.0052660000000059);
tmpLen=Charleston.length;
Charleston[tmpLen] = createMarker(tmpLatLng,"",iconGr);
Charleston[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Trident Technical College",'Charleston=' + Charleston.length);
tmpLatLng=new GLatLng(32.43619400000000041,-80.6695229999999980);
tmpLen=Bluffton.length;
Bluffton[tmpLen] = createMarker(tmpLatLng,"",iconGr);
Bluffton[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("University Of South Carolina-beaufort",'Bluffton=' + Bluffton.length);
tmpLatLng=new GLatLng(34.74602900000000005,-80.7788510000000030);
tmpLen=Lancaster.length;
Lancaster[tmpLen] = createMarker(tmpLatLng,"",iconGr);
Lancaster[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("University Of South Carolina-lancaster",'Lancaster=' + Lancaster.length);
tmpLatLng=new GLatLng(33.01720000000000254,-81.2980000000000018);
tmpLen=Allendale.length;
Allendale[tmpLen] = createMarker(tmpLatLng,"",iconGr);
Allendale[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("University Of South Carolina-salkehatchie",'Allendale=' + Allendale.length);
tmpLatLng=new GLatLng(33.93266700000000213,-80.3727800000000058);
tmpLen=Sumter.length;
Sumter[tmpLen] = createMarker(tmpLatLng,"",iconGr);
Sumter[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("University Of South Carolina-sumter",'Sumter=' + Sumter.length);
tmpLatLng=new GLatLng(34.71732300000000037,-81.6215109999999981);
tmpLen=Union.length;
Union[tmpLen] = createMarker(tmpLatLng,"",iconGr);
Union[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("University Of South Carolina-union",'Union=' + Union.length);
tmpLatLng=new GLatLng(33.64864699999999686,-79.8151960000000002);
tmpLen=Kingstree.length;
Kingstree[tmpLen] = createMarker(tmpLatLng,"",iconGr);
Kingstree[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Williamsburg Technical College",'Kingstree=' + Kingstree.length);
tmpLatLng=new GLatLng(34.93352900000000005,-80.9960329999999970);
tmpLen=Rock_Hill.length;
Rock_Hill[tmpLen] = createMarker(tmpLatLng,"",iconGr);
Rock_Hill[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("York Technical College",'Rock_Hill=' + Rock_Hill.length);
map.removeOverlays(Allendale);
map.removeOverlays(Anderson);
map.removeOverlays(Beaufort);
map.removeOverlays(Bluffton);
map.removeOverlays(Charleston);
map.removeOverlays(Cheraw);
map.removeOverlays(Columbia);
map.removeOverlays(Conway);
map.removeOverlays(Denmark);
map.removeOverlays(Florence);
map.removeOverlays(Graniteville);
map.removeOverlays(Greenville);
map.removeOverlays(Greenwood);
map.removeOverlays(Kingstree);
map.removeOverlays(Lancaster);
map.removeOverlays(Myrtle_Beach);
map.removeOverlays(Orangeburg);
map.removeOverlays(Pendleton);
map.removeOverlays(Rock_Hill);
map.removeOverlays(Spartanburg);
map.removeOverlays(Sumter);
map.removeOverlays(Union);
map.removeOverlays(West_Columbia);
setTimeout(function(){map.addOverlays(Allendale)},1000);
setTimeout(function(){map.addOverlays(Anderson)},1000);
setTimeout(function(){map.addOverlays(Beaufort)},1000);
setTimeout(function(){map.addOverlays(Bluffton)},1000);
setTimeout(function(){map.addOverlays(Charleston)},1000);
setTimeout(function(){map.addOverlays(Cheraw)},1000);
setTimeout(function(){map.addOverlays(Columbia)},1000);
setTimeout(function(){map.addOverlays(Conway)},1000);
setTimeout(function(){map.addOverlays(Denmark)},1000);
setTimeout(function(){map.addOverlays(Florence)},1000);
setTimeout(function(){map.addOverlays(Graniteville)},1000);
setTimeout(function(){map.addOverlays(Greenville)},1000);
setTimeout(function(){map.addOverlays(Greenwood)},1000);
setTimeout(function(){map.addOverlays(Kingstree)},1000);
setTimeout(function(){map.addOverlays(Lancaster)},1000);
setTimeout(function(){map.addOverlays(Myrtle_Beach)},1000);
setTimeout(function(){map.addOverlays(Orangeburg)},1000);
setTimeout(function(){map.addOverlays(Pendleton)},1000);
setTimeout(function(){map.addOverlays(Rock_Hill)},1000);
setTimeout(function(){map.addOverlays(Spartanburg)},1000);
setTimeout(function(){map.addOverlays(Sumter)},1000);
setTimeout(function(){map.addOverlays(Union)},1000);
setTimeout(function(){map.addOverlays(West_Columbia)},1000);
getPoly("","state","","SC");}
// End addStateMarkers JavaScript Function
//open all when map is defined
function openAll() {
if (map) {
selectChange("all");
} else {
setTimeout("openAll()",200);
}
}
// 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].point.x;
var markLat = myArray[i].point.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].point.x;
maxLat = myArray[0].point.y;
minLng = myArray[0].point.x;
minLat = myArray[0].point.y;
}
// Recenter map based on global max/mins
function reCenterMap(){
//alert('#' + minLat + '#' + minLng + '#' + maxLat + '#' + maxLng);
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) {
if (selection.options) {
var _openNewWindow=true;
var myVal = selection.options[selection.selectedIndex].value;
} else {
var _openNewWindow=false;
var myVal=selection;
}
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('schools-by-distance') == -1)
window.open(location.href + '/map/all');
else
window.open('/search////all');
map.removeOverlays(Allendale);
map.removeOverlays(Anderson);
map.removeOverlays(Beaufort);
map.removeOverlays(Bluffton);
map.removeOverlays(Charleston);
map.removeOverlays(Cheraw);
map.removeOverlays(Columbia);
map.removeOverlays(Conway);
map.removeOverlays(Denmark);
map.removeOverlays(Florence);
map.removeOverlays(Graniteville);
map.removeOverlays(Greenville);
map.removeOverlays(Greenwood);
map.removeOverlays(Kingstree);
map.removeOverlays(Lancaster);
map.removeOverlays(Myrtle_Beach);
map.removeOverlays(Orangeburg);
map.removeOverlays(Pendleton);
map.removeOverlays(Rock_Hill);
map.removeOverlays(Spartanburg);
map.removeOverlays(Sumter);
map.removeOverlays(Union);
map.removeOverlays(West_Columbia);
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(Graniteville);map.removeOverlays(Allendale);
map.removeOverlays(Anderson);
map.removeOverlays(Beaufort);
map.removeOverlays(Bluffton);
map.removeOverlays(Charleston);
map.removeOverlays(Cheraw);
map.removeOverlays(Columbia);
map.removeOverlays(Conway);
map.removeOverlays(Denmark);
map.removeOverlays(Florence);
map.removeOverlays(Graniteville);
map.removeOverlays(Greenville);
map.removeOverlays(Greenwood);
map.removeOverlays(Kingstree);
map.removeOverlays(Lancaster);
map.removeOverlays(Myrtle_Beach);
map.removeOverlays(Orangeburg);
map.removeOverlays(Pendleton);
map.removeOverlays(Rock_Hill);
map.removeOverlays(Spartanburg);
map.removeOverlays(Sumter);
map.removeOverlays(Union);
map.removeOverlays(West_Columbia);
map.addOverlays(Allendale);
centerByArray(Allendale, false, false);
cntMarker += Allendale.length;
map.addOverlays(Anderson);
centerByArray(Anderson, false, false);
cntMarker += Anderson.length;
map.addOverlays(Beaufort);
centerByArray(Beaufort, false, false);
cntMarker += Beaufort.length;
map.addOverlays(Bluffton);
centerByArray(Bluffton, false, false);
cntMarker += Bluffton.length;
map.addOverlays(Charleston);
centerByArray(Charleston, false, false);
cntMarker += Charleston.length;
map.addOverlays(Cheraw);
centerByArray(Cheraw, false, false);
cntMarker += Cheraw.length;
map.addOverlays(Columbia);
centerByArray(Columbia, false, false);
cntMarker += Columbia.length;
map.addOverlays(Conway);
centerByArray(Conway, false, false);
cntMarker += Conway.length;
map.addOverlays(Denmark);
centerByArray(Denmark, false, false);
cntMarker += Denmark.length;
map.addOverlays(Florence);
centerByArray(Florence, false, false);
cntMarker += Florence.length;
map.addOverlays(Graniteville);
centerByArray(Graniteville, false, false);
cntMarker += Graniteville.length;
map.addOverlays(Greenville);
centerByArray(Greenville, false, false);
cntMarker += Greenville.length;
map.addOverlays(Greenwood);
centerByArray(Greenwood, false, false);
cntMarker += Greenwood.length;
map.addOverlays(Kingstree);
centerByArray(Kingstree, false, false);
cntMarker += Kingstree.length;
map.addOverlays(Lancaster);
centerByArray(Lancaster, false, false);
cntMarker += Lancaster.length;
map.addOverlays(Myrtle_Beach);
centerByArray(Myrtle_Beach, false, false);
cntMarker += Myrtle_Beach.length;
map.addOverlays(Orangeburg);
centerByArray(Orangeburg, false, false);
cntMarker += Orangeburg.length;
map.addOverlays(Pendleton);
centerByArray(Pendleton, false, false);
cntMarker += Pendleton.length;
map.addOverlays(Rock_Hill);
centerByArray(Rock_Hill, false, false);
cntMarker += Rock_Hill.length;
map.addOverlays(Spartanburg);
centerByArray(Spartanburg, false, false);
cntMarker += Spartanburg.length;
map.addOverlays(Sumter);
centerByArray(Sumter, false, false);
cntMarker += Sumter.length;
map.addOverlays(Union);
centerByArray(Union, false, false);
cntMarker += Union.length;
map.addOverlays(West_Columbia);
centerByArray(West_Columbia, false, false);
cntMarker += West_Columbia.length;
reCenterMap();
//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');
}
}
function createMarker(point, label, icon){
var marker = new GMarker(point, icon);
var html = label;
GEvent.addListener(marker, "click", function() { marker.openInfoWindowHtml(html); });
return marker;
}