var textSearch = new Array(200);
var textReplace = new Array(200);

// INSTRUCTIONS:
//
// textSearch[#]:  folder name to replace, string must be lower-case
// textReaplce[#]: name to display on the breadcrumbs
// 
// Increment # by 1 for each additional. Must be in order. Add to the bottom of the list

textSearch[1] = "aafp";
textReplace[1] = "American Association of Feline Practitioners";
textSearch[2] = "acvp";
textReplace[2] = "Student Chapter of the American College of Veterinary Pathologists";
textSearch[3] = "afcat";
textReplace[3] = "Aggie Feral Cat Alliance of Texas";
textSearch[4] = "ahvma";
textReplace[4] = "American Holistic Veterinary Medical Association";
textSearch[5] = "alumni";
textReplace[5] = "CVM Alumni";
textSearch[6] = "bims";
textReplace[6] = "Biomedical Science";
textSearch[7] = "bsa";
textReplace[7] = "Biomedical Science Association";
textSearch[8] = "bvhs";
textReplace[8] = "Brazos Valley Herpetological Society";
textSearch[9] = "calendar";
textReplace[9] = "CVM College Calendar";
textSearch[10] = "ce";
textReplace[10] = "Continuing Education";
textSearch[11] = "cesupportsites";
textReplace[11] = "Continuing Education Support Sites";
textSearch[12] = "cgr";
textReplace[12] = "Canine Genetics Research";
textSearch[13] = "clinicalnutrition";
textReplace[13] = "Clinical Nutrition";
textSearch[14] = "clinpath";
textReplace[14] = "Clinical Pathology Laboratory";
textSearch[15] = "college%5Finfo";
textReplace[15] = "About the College of Veterinary Medicine";
textSearch[16] = "collegehour";
textReplace[16] = "College Hour";
textSearch[17] = "cquick";
textReplace[17] = "Cardiovascular Systems Dynamics Lab";
textSearch[18] = "cvmtoday";
textReplace[18] = "CVM Today";
textSearch[19] = "dcvm";
textReplace[19] = "DVM Program";
textSearch[20] = "derr";
textReplace[20] = "Dr. James Derr";
textSearch[21] = "ecr";
textReplace[21] = "Educational and Communications Resource";
textSearch[22] = "externjob";
textReplace[22] = "Veterinary Jobs and Externships Database";
textSearch[23] = "faculty";
textReplace[23] = "CVM Faculty";
textSearch[24] = "facultyrec";
textReplace[24] = "CVM Faculty Recruitment";
textSearch[25] = "fadadmin";
textReplace[25] = "Foreign Animal Disease Recognition";
textSearch[26] = "fadr";
textReplace[26] = "Foreign Animal Disease Recognition";
textSearch[27] = "gilab";
textReplace[27] = "Gastrointestinal Laboratory";
textSearch[28] = "gilab-development";
textReplace[28] = "Gastrointestinal Laboratory";
textSearch[29] = "giving";
textReplace[29] = "Giving Opportunities";
textSearch[30] = "gsa";
textReplace[30] = "Graduate Student Association";
textSearch[31] = "is";
textReplace[31] = "Information Systems";
textSearch[32] = "ecr";
textReplace[32] = "Educational and Communications Resource";
textSearch[33] = "ial";
textReplace[33] = "Image Analysis Lab";
textSearch[34] = "icucases";
textReplace[34] = "Intensive Care Unit Cases";
textSearch[35] = "idev";
textReplace[35] = "Office of Instructional Design";
textSearch[36] = "newfacultybios";
textReplace[36] = "New Faculty Bios";
textSearch[37] = "news";
textReplace[37] = "Public Relations, News, and Media Information";
textSearch[38] = "outstandingalum";
textReplace[38] = "Outstanding Alumni";
textSearch[39] = "pelvme";
textReplace[39] = "Program for Executive Leadership in Veterinary Medicine";
textSearch[40] = "portal";
textReplace[40] = "CVM Portal";
textSearch[41] = "qep";
textReplace[41] = "Quality Enhancement Plan Council";
textSearch[42] = "resgrad";
textReplace[42] = "Research and Graduate Studies";
textSearch[43] = "supplementalapplication";
textReplace[43] = "Supplemental Application";
textSearch[44] = "vibs";
textReplace[44] = "Veterinary Integrative Biological Sciences";
textSearch[45] = "vlcs";
textReplace[45] = "Large Animal Clinical Sciences";
textSearch[46] = "vscs";
textReplace[46] = "Small Animal Clinical Sciences";
textSearch[47] = "vtpp";
textReplace[47] = "Veterinary Physiology and Pharmacology";
textSearch[48] = "womack";
textReplace[48] = "Dr. James E. Womack";
textSearch[49] = "zew";
textReplace[49] = "Zoo, Exoctics, Wildlife Medicine Group";
textSearch[50] = "college_info";
textReplace[50] = "College Information";
textSearch[51] = "ssr";
textReplace[51] = "Summer Veterinary Student Research Fellows Program";
textSearch[52] = "researchforms";
textReplace[52] = "Research Forms";
textSearch[52] = "brochure";
textReplace[52] = "Graduate Brochure";
textSearch[53] = "grad";
textReplace[53] = "Graduate Studies";
textSearch[54] = "wklemm";
textReplace[54] = "Dr. Bill Klemm";
textSearch[55] = "cccc";
textReplace[55] = "Caring, Curing, Creating, Communicating";
textSearch[56] = "laemcc";
textReplace[56] = "Large Animal Emergency Critical Care Service";
textSearch[57] = "sa_er";
textReplace[57] = "Small Animal Emergency Critical Care Service";
textSearch[57] = "hospservices";
textReplace[57] = "Hospital Services";
function replaceAll( str, searchTerm, replaceWith, ignoreCase )   {
   var regex = "/"+searchTerm+"/g";
   if( ignoreCase ) regex += "i";
   return str.replace( eval(regex), replaceWith );
}

function capitalizeMe(obj) {
        var val = obj;
        newVal = '';
        val = val.split(' ');
        for(var c=0; c < val.length; c++) {
                newVal += val[c].substring(0,1).toUpperCase() + val[c].substring(1,val[c].length) + ' ';
        }
        return newVal;
}

function camelCaps(str, theCase) {
  var tempArray = str.split(' ');

  // Make the first character of each word upper- or lowercase
  // depending on the value of theCase
  for (var i = 0; i < tempArray.length; i++) {
    if (theCase) {
      tempArray[i] = tempArray[i].charAt(0).toUpperCase() + tempArray[i].substring(1);
      }
    else {
      tempArray[i] = tempArray[i].charAt(0).toLowerCase() + tempArray[i].substring(1);
      };
    }
  return tempArray.join(' ');
}
function breadcrumbs(){
  sURL = new String;
  bits = new Object;
  var minArray = 0;
  var maxArray = textSearch.length;
  var x = 0;
  var stop = 0;
  var output = "<a href=\"/\">Home</a> &nbsp;&raquo;&nbsp; ";
  sURL = location.href;
  sURL = sURL.slice(8,sURL.length);
  chunkStart = sURL.indexOf("/");
  sURL = sURL.slice(chunkStart+1,sURL.length)
  while(!stop){
    chunkStart = sURL.indexOf("/");
    if (chunkStart != -1){
      bits[x] = sURL.slice(0,chunkStart)
      sURL = sURL.slice(chunkStart+1,sURL.length);
    }else{
      stop = 1;
    }
    x++;
  }
  for(var i in bits){
    output += "<a href=\"";
    for(y=1;y<x-i;y++){
      output += "../";
    }
	var newString = bits[i].toLowerCase();
	for(z=minArray; z<maxArray; z++) {
		if (newString == textSearch[z]) {
			newString = textReplace[z];
			var existsInArray = 1;
		}
	}
	if (existsInArray != 1)
		newString = camelCaps(newString, true);
		newString = replaceAll(newString, "%20", " ");
		newString = replaceAll(newString, "_", " ");
		newString = capitalizeMe(newString);

	output += bits[i] + "/\">" + newString + "</a> &nbsp;&raquo;&nbsp; ";
  }
  document.write(output + document.title);
}