//	Breadcrumb Trail Script > Original Code by Paul Davis, Kaosweaver.com
//	Underscore Replace Modification > Robertson Odom, Venturi Technology Partners - Richmond
//	Tab-index Accessibility Modification > Robertson Odom, Venturi Technology Partners - Richmond
//	Format Special Characters / Really Long Names Modification > Robertson Odom, Venturi Technology Partners - Richmond
//  No crumb trail on the homepage modification > Robertson Odom, Venturi Technology Partners - Richmond
/*  ABBREVIATIONS:
	defp     | "default page"
	cStyle   | "crumb style" (the links)
	tStyle   | "target style" (the current page; no link)
	dStyle   | "delimiter style"
	bmprefix | "bookmark prefix" the redundant part of the page title that we strip out
	nl       | "new line" - not used often
*/
function breadCrumbs(base,delStr,defp,cStyle,tStyle,dStyle,nl,bmprefix) {
	tabcount = 350; // tabindex range to start against, i.e. 350 > 349 > 348 etc.
	loc = window.location.toString();
	subs = loc.substr(loc.indexOf(base)+base.length+1).split("/");
	if(subs.length <=1){
	//alert("subs is less than 2");
		return;
	} else {	
	document.write('<a href="'+getLoc(subs.length-1)+defp+'" tabindex="' + tabcount + '" class="'+cStyle+'">YMCA ATLANTA HOME</a>  '+'<span class="'+dStyle+'">'+delStr+'</span> ');
	tabcount--;
	a=(loc.indexOf(defp)==-1)?1:2;
	for (i=0;i<(subs.length-a);i++) { 
		subs[i]=replaceUnderscores(unescape(subs[i]));
		subs[i]=makeCaps(unescape(subs[i]));
		subs[i]=formatSpecial(unescape(subs[i]));
		document.write('<a href="'+getLoc(subs.length-i-2)+defp+'" tabindex="' + tabcount + '" class="'+cStyle+'">'+subs[i]+'</a>  '+'<span class="'+dStyle+'">'+delStr+'</span> ');
		tabcount--;
		} 
	if (nl==1) 	document.write("<br>");
	if (document.title.indexOf(bmprefix) > -1){
		count = bmprefix.length;
		newTitle = document.title.substr(count);
	} else {
		newTitle = document.title;
		}
	document.write('<span class="'+tStyle+'">'+newTitle+'</span>');
	document.close();
}

function getLoc(c) {
var d = "";
if (c > 0) {
	for (k = 0; k < c; k++) {

		d = d + "../";
		}
	}
return d;
}

function replaceUnderscores(a){
var g = a.split("_");
return g.join(" ");
}

function makeCaps(a) {
var g = a.split(" ");
for (var l = 0; l < g.length; l++) {
	g[l] = g[l].toUpperCase().slice(0, 1) + g[l].slice(1);
	}
return g.join(" ");
}

function formatSpecial(a){
var g = a.split(" ");
for(var l = 0; l < g.length; l++){
	if (g[l] == "Camp_Thunderbird") 	{ g[l] = "Camp Thunderbird Outdoor Center"; } else {
	if (g[l] == "Chester_YMCA") 		{ g[l] = "Chester Family YMCA"; } else {
	if (g[l] == "Chickahominy_YMCA") 	{ g[l] = "Chickahominy Family YMCA"; } else {
	if (g[l] == "Downtown_YMCA") 		{ g[l] = "Downtown YMCA"; } else {
	if (g[l] == "Downtown_Daycare") 	{ g[l] = "Downtown Daycare"; } else {
	if (g[l] == "Goochland_YMCA") 	{ g[l] = "Goochland Family YMCA"; } else {
	if (g[l] == "Manchester_YMCA") 	{ g[l] = "Manchester Family YMCA"; } else {
	if (g[l] == "Midlothian_YMCA") 	{ g[l] = "Midlothian Family YMCA"; } else {
	if (g[l] == "North_Richmond_YMCA") { g[l] = "North Richmond YMCA Community Center"; } else {
	if (g[l] == "Patrich_Henry_YNCA") 	{ g[l] = "Patrich Henry Family YMCA"; } else {
	if (g[l] == "Powhatan_YNCA") 		{ g[l] = "Elizabeth Randolph Lewis Powhatan YMCA"; } else {
	if (g[l] == "Shady_Grove_YMCA") 	{ g[l] = "Shady Grove Family YMCA"; } else {
	if (g[l] == "Southside_VA_YMCA") 	{ g[l] = "Southside Virginia Family YMCA"; } else {
	if (g[l] == "Tuckahoe_YMCA")		{ g[l] = "Tuckahoe Family YMCA"; }
	}}}}}}}}}}}}}}	//	make these closing brackets match the total number of if statements above
return g.join(" ");
}}
// end breadcrumbs function definitions