function getElementsByClassName(strClass, strTag, objContElm) {
  strTag = strTag || "*";
  objContElm = objContElm || document;
  var objColl = objContElm.getElementsByTagName(strTag);
  if (!objColl.length &&  strTag == "*" &&  objContElm.all) objColl = objContElm.all;
  var arr = new Array();
  var delim = strClass.indexOf('|') !=1  ? '|' : ' ';
  var arrClass = strClass.split(delim);
  for (var i = 0, j = objColl.length; i < j; i++) {
    var arrObjClass = objColl[i].className.split(' ');
    if (delim == ' ' && arrClass.length > arrObjClass.length) continue;
    var c = 0;
    comparisonLoop:
    for (var k = 0, l = arrObjClass.length; k < l; k++) {
      for (var m = 0, n = arrClass.length; m < n; m++) {
        if (arrClass[m] == arrObjClass[k]) c++;
        if (( delim == '|' && c == 1) || (delim == ' ' && c == arrClass.length)) {
          arr.push(objColl[i]);
          break comparisonLoop;
        }
      }
    }
  }
  return arr;
}


//--------------------------------------------------------------
function showplace(thing) {
	
	var location_info = getElementsByClassName('location_info');
for (var i = 0, j = location_info.length; i < j; i++) {
   location_info[i].style.display = "none";
}
	
	document.getElementById(thing).style.display = "block";

}
//---This defines the rep object-----------------------------

function rep(area, email) {
    this.area = area;
    this.email = email;
}


//---This function adds a rep to the array-----------------------
function set_rep(the_array, objectArrayIndex, area, email) {
    the_array[objectArrayIndex++] = new rep(area, email);
}

//---This sets up the rep email array, and sets the email to the rep email on selection------
function set_email(the_area) {
	var rep_array = new Array();

	rep_array[0] = new rep("paducah","skimbell@midcontinent.edu");
	rep_array[1] = new rep("calvert","skimbell@midcontinent.edu");
	rep_array[2] = new rep("mayfield","jpuckett@midcontinent.edu");
	rep_array[3] = new rep("fulton","jpuckett@midcontinent.edu");
	rep_array[4] = new rep("hopkinsville","khatton@midcontinent.edu");
	rep_array[5] = new rep("princeton","khatton@midcontinent.edu");
	rep_array[6] = new rep("murray","khatton@midcontinent.edu");
	rep_array[7] = new rep("cadiz","khatton@midcontinent.edu");
	rep_array[8] = new rep("madisonville","bfranklin@midcontinent.edu");
	rep_array[9] = new rep("owensboro","bfranklin@midcontinent.edu");
	rep_array[10] = new rep("henderson","bfranklin@midcontinent.edu");
	rep_array[11] = new rep("louisville","ejetton@midcontinent.edu");
	rep_array[12] = new rep("shepherdsville","ejetton@midcontinent.edu");
	rep_array[13] = new rep("bowling_green","tculver@midcontinent.edu");
	rep_array[14] = new rep("russellville","tculver@midcontinent.edu");
	rep_array[15] = new rep("morgantown","tculver@midcontinent.edu");
	rep_array[16] = new rep("bardstown","gbeavers@midcontinent.edu");
	rep_array[17] = new rep("lebanon","gbeavers@midcontinent.edu");
	rep_array[18] = new rep("covington","rshipley@midcontinent.edu");
	rep_array[19] = new rep("frankfort","lgray@midcontinent.edu");
	rep_array[20] = new rep("lexington","lgray@midcontinent.edu");
	rep_array[21] = new rep("shelbyville","lgray@midcontinent.edu");
	rep_array[22] = new rep("richmond","dbailey@midcontinent.edu");
	rep_array[23] = new rep("danville","dbailey@midcontinent.edu");        
	rep_array[24] = new rep("shawnee","sborders@midcontinent.edu");
	rep_array[25] = new rep("JALC","sborders@midcontinent.edu");
	rep_array[26] = new rep("metropolis","sborders@midcontinent.edu");
	rep_array[27] = new rep("RLC","mmckenzie@midcontinent.edu");
	rep_array[28] = new rep("SIC","mmckenzie@midcontinent.edu");
	rep_array[29] = new rep("pinckneyville","mmckenzie@midcontinent.edu");
	rep_array[30] = new rep("online","online@midcontinent.edu");
	rep_array[31] = new rep("psych","jpuckett@midcontinent.edu");
	rep_array[32] = new rep("test","jgarbe@horizonmediagroup.com");
	
	
	for(var i = 0; i < rep_array.length; i++) {
		if(rep_array[i].area == the_area) {
			the_email = rep_array[i].email;
		}
	}
	
document.getElementById("my_email").value = the_email + "\, advantage@midcontinent.edu";	
	
}

function autodisplay(variable) {    //this function loads the page with a place displayed, ?location=fultion, for example
  var query = window.location.search.substring(1);
  var vars = query.split("&");
  for (var i=0;i<vars.length;i++) {
    var pair = vars[i].split("=");
    if (pair[0] == variable) {
	  showplace(pair[1]);
    }
  }
} 