function addMarkers(){
mySelect = document.getElementById('selection');
Muskogee = [];Poteau = [];Warner = [];Wilburton = [];Tishomingo = [];Miami = [];Tonkawa = [];Oklahoma_City = [];Okmulgee = [];El_Reno = [];Claremore = [];Midwest_City = [];Seminole = [];Tulsa = [];Altus = [];mySelect.options[mySelect.options.length] = new Option("Altus Schools",'all=Altus');
mySelect.options[mySelect.options.length] = new Option("Claremore Schools",'all=Claremore');
mySelect.options[mySelect.options.length] = new Option("El Reno Schools",'all=El_Reno');
mySelect.options[mySelect.options.length] = new Option("Miami Schools",'all=Miami');
mySelect.options[mySelect.options.length] = new Option("Midwest City Schools",'all=Midwest_City');
mySelect.options[mySelect.options.length] = new Option("Muskogee Schools",'all=Muskogee');
mySelect.options[mySelect.options.length] = new Option("Oklahoma City Schools",'all=Oklahoma_City');
mySelect.options[mySelect.options.length] = new Option("Okmulgee Schools",'all=Okmulgee');
mySelect.options[mySelect.options.length] = new Option("Poteau Schools",'all=Poteau');
mySelect.options[mySelect.options.length] = new Option("Seminole Schools",'all=Seminole');
mySelect.options[mySelect.options.length] = new Option("Tishomingo Schools",'all=Tishomingo');
mySelect.options[mySelect.options.length] = new Option("Tonkawa Schools",'all=Tonkawa');
mySelect.options[mySelect.options.length] = new Option("Tulsa Schools",'all=Tulsa');
mySelect.options[mySelect.options.length] = new Option("Warner Schools",'all=Warner');
mySelect.options[mySelect.options.length] = new Option("Wilburton Schools",'all=Wilburton');
mySelect.options[mySelect.options.length] = new Option("---------------------------",'');
var tmpLatLng=0;
var tmpLen=0;
tmpLatLng=new GLatLng(35.77453500000000019,-95.3350480000000004);
tmpLen=Muskogee.length;
Muskogee[tmpLen] = createMarker(tmpLatLng,"
",iconRd);
Muskogee[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Bacone College",'Muskogee=' + Muskogee.length);
tmpLatLng=new GLatLng(35.04021000000000185,-94.6358019999999982);
tmpLen=Poteau.length;
Poteau[tmpLen] = createMarker(tmpLatLng,"",iconGr);
Poteau[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Carl Albert State College",'Poteau=' + Poteau.length);
tmpLatLng=new GLatLng(35.49020000000000152,-95.3213999999999970);
tmpLen=Warner.length;
Warner[tmpLen] = createMarker(tmpLatLng,"",iconGr);
Warner[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Connors State College",'Warner=' + Warner.length);
tmpLatLng=new GLatLng(34.91316400000000186,-95.3275050000000021);
tmpLen=Wilburton.length;
Wilburton[tmpLen] = createMarker(tmpLatLng,"",iconGr);
Wilburton[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Eastern Oklahoma State College",'Wilburton=' + Wilburton.length);
tmpLatLng=new GLatLng(34.22316200000000208,-96.6787649999999985);
tmpLen=Tishomingo.length;
Tishomingo[tmpLen] = createMarker(tmpLatLng,"",iconGr);
Tishomingo[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Murray State College",'Tishomingo=' + Tishomingo.length);
tmpLatLng=new GLatLng(36.87764599999999859,-94.8677760000000063);
tmpLen=Miami.length;
Miami[tmpLen] = createMarker(tmpLatLng,"",iconGr);
Miami[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Northeastern Oklahoma A&m College",'Miami=' + Miami.length);
tmpLatLng=new GLatLng(36.67841599999999857,-97.2983899999999977);
tmpLen=Tonkawa.length;
Tonkawa[tmpLen] = createMarker(tmpLatLng,"",iconGr);
Tonkawa[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Northern Oklahoma College",'Tonkawa=' + Tonkawa.length);
tmpLatLng=new GLatLng(35.38894400000000217,-97.5656160000000056);
tmpLen=Oklahoma_City.length;
Oklahoma_City[tmpLen] = createMarker(tmpLatLng,"",iconGr);
Oklahoma_City[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Oklahoma City Community College",'Oklahoma_City=' + Oklahoma_City.length);
tmpLatLng=new GLatLng(35.62444800000000100,-95.9439409999999952);
tmpLen=Okmulgee.length;
Okmulgee[tmpLen] = createMarker(tmpLatLng,"",iconGr);
Okmulgee[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Oklahoma State University Institute Of Technology",'Okmulgee=' + Okmulgee.length);
tmpLatLng=new GLatLng(35.47505799999999709,-97.5832170000000047);
tmpLen=Oklahoma_City.length;
Oklahoma_City[tmpLen] = createMarker(tmpLatLng,"",iconGr);
Oklahoma_City[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Oklahoma State University-oklahoma City",'Oklahoma_City=' + Oklahoma_City.length);
tmpLatLng=new GLatLng(35.52246399999999937,-97.9725609999999988);
tmpLen=El_Reno.length;
El_Reno[tmpLen] = createMarker(tmpLatLng,"",iconGr);
El_Reno[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Redlands Community College",'El_Reno=' + El_Reno.length);
tmpLatLng=new GLatLng(36.31866500000000286,-95.6305830000000014);
tmpLen=Claremore.length;
Claremore[tmpLen] = createMarker(tmpLatLng,"",iconGr);
Claremore[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Rogers State University",'Claremore=' + Claremore.length);
tmpLatLng=new GLatLng(35.44956299999999771,-97.4132910000000009);
tmpLen=Midwest_City.length;
Midwest_City[tmpLen] = createMarker(tmpLatLng,"",iconGr);
Midwest_City[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Rose State College",'Midwest_City=' + Midwest_City.length);
tmpLatLng=new GLatLng(35.23928099999999830,-96.6943770000000029);
tmpLen=Seminole.length;
Seminole[tmpLen] = createMarker(tmpLatLng,"",iconGr);
Seminole[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Seminole State College",'Seminole=' + Seminole.length);
tmpLatLng=new GLatLng(36.17699499999999801,-95.8785330000000044);
tmpLen=Tulsa.length;
Tulsa[tmpLen] = createMarker(tmpLatLng,"",iconRd);
Tulsa[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Spartan College Of Aeronautics And Technology",'Tulsa=' + Tulsa.length);
tmpLatLng=new GLatLng(36.10485099999999647,-95.9094029999999975);
tmpLen=Tulsa.length;
Tulsa[tmpLen] = createMarker(tmpLatLng,"",iconGr);
Tulsa[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Tulsa Community College",'Tulsa=' + Tulsa.length);
tmpLatLng=new GLatLng(36.14721000000000117,-95.9547639999999972);
tmpLen=Tulsa.length;
Tulsa[tmpLen] = createMarker(tmpLatLng,"",iconRd);
Tulsa[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Tulsa Welding School",'Tulsa=' + Tulsa.length);
tmpLatLng=new GLatLng(34.66669199999999762,-99.3339880000000050);
tmpLen=Altus.length;
Altus[tmpLen] = createMarker(tmpLatLng,"",iconGr);
Altus[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Western Oklahoma State College",'Altus=' + Altus.length);
map.removeOverlays(Altus);
map.removeOverlays(Claremore);
map.removeOverlays(El_Reno);
map.removeOverlays(Miami);
map.removeOverlays(Midwest_City);
map.removeOverlays(Muskogee);
map.removeOverlays(Oklahoma_City);
map.removeOverlays(Okmulgee);
map.removeOverlays(Poteau);
map.removeOverlays(Seminole);
map.removeOverlays(Tishomingo);
map.removeOverlays(Tonkawa);
map.removeOverlays(Tulsa);
map.removeOverlays(Warner);
map.removeOverlays(Wilburton);
setTimeout(function(){map.addOverlays(Altus)},1000);
setTimeout(function(){map.addOverlays(Claremore)},1000);
setTimeout(function(){map.addOverlays(El_Reno)},1000);
setTimeout(function(){map.addOverlays(Miami)},1000);
setTimeout(function(){map.addOverlays(Midwest_City)},1000);
setTimeout(function(){map.addOverlays(Muskogee)},1000);
setTimeout(function(){map.addOverlays(Oklahoma_City)},1000);
setTimeout(function(){map.addOverlays(Okmulgee)},1000);
setTimeout(function(){map.addOverlays(Poteau)},1000);
setTimeout(function(){map.addOverlays(Seminole)},1000);
setTimeout(function(){map.addOverlays(Tishomingo)},1000);
setTimeout(function(){map.addOverlays(Tonkawa)},1000);
setTimeout(function(){map.addOverlays(Tulsa)},1000);
setTimeout(function(){map.addOverlays(Warner)},1000);
setTimeout(function(){map.addOverlays(Wilburton)},1000);
getPoly("","state","","OK");}
// 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(Altus);
map.removeOverlays(Claremore);
map.removeOverlays(El_Reno);
map.removeOverlays(Miami);
map.removeOverlays(Midwest_City);
map.removeOverlays(Muskogee);
map.removeOverlays(Oklahoma_City);
map.removeOverlays(Okmulgee);
map.removeOverlays(Poteau);
map.removeOverlays(Seminole);
map.removeOverlays(Tishomingo);
map.removeOverlays(Tonkawa);
map.removeOverlays(Tulsa);
map.removeOverlays(Warner);
map.removeOverlays(Wilburton);
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(Muskogee);map.removeOverlays(Altus);
map.removeOverlays(Claremore);
map.removeOverlays(El_Reno);
map.removeOverlays(Miami);
map.removeOverlays(Midwest_City);
map.removeOverlays(Muskogee);
map.removeOverlays(Oklahoma_City);
map.removeOverlays(Okmulgee);
map.removeOverlays(Poteau);
map.removeOverlays(Seminole);
map.removeOverlays(Tishomingo);
map.removeOverlays(Tonkawa);
map.removeOverlays(Tulsa);
map.removeOverlays(Warner);
map.removeOverlays(Wilburton);
map.addOverlays(Altus);
centerByArray(Altus, false, false);
cntMarker += Altus.length;
map.addOverlays(Claremore);
centerByArray(Claremore, false, false);
cntMarker += Claremore.length;
map.addOverlays(El_Reno);
centerByArray(El_Reno, false, false);
cntMarker += El_Reno.length;
map.addOverlays(Miami);
centerByArray(Miami, false, false);
cntMarker += Miami.length;
map.addOverlays(Midwest_City);
centerByArray(Midwest_City, false, false);
cntMarker += Midwest_City.length;
map.addOverlays(Muskogee);
centerByArray(Muskogee, false, false);
cntMarker += Muskogee.length;
map.addOverlays(Oklahoma_City);
centerByArray(Oklahoma_City, false, false);
cntMarker += Oklahoma_City.length;
map.addOverlays(Okmulgee);
centerByArray(Okmulgee, false, false);
cntMarker += Okmulgee.length;
map.addOverlays(Poteau);
centerByArray(Poteau, false, false);
cntMarker += Poteau.length;
map.addOverlays(Seminole);
centerByArray(Seminole, false, false);
cntMarker += Seminole.length;
map.addOverlays(Tishomingo);
centerByArray(Tishomingo, false, false);
cntMarker += Tishomingo.length;
map.addOverlays(Tonkawa);
centerByArray(Tonkawa, false, false);
cntMarker += Tonkawa.length;
map.addOverlays(Tulsa);
centerByArray(Tulsa, false, false);
cntMarker += Tulsa.length;
map.addOverlays(Warner);
centerByArray(Warner, false, false);
cntMarker += Warner.length;
map.addOverlays(Wilburton);
centerByArray(Wilburton, false, false);
cntMarker += Wilburton.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;
}