
var sitePrefix = "/";
	
var breadCrumbSeparator = " > ";


var breadCrumbLabels = new Array();
breadCrumbLabels["animalcare"] = "Animal Care and Saddlery";
breadCrumbLabels["arboriculture"] = "Arboriculture and Countryside";
breadCrumbLabels["balloonartistry"] = "Balloon Artistry";
breadCrumbLabels["floristry"] = "Floristry and Flower Arranging";
breadCrumbLabels["gardendesign"] = "Garden Design";
breadCrumbLabels["horticulture"] = "Horticulture";
breadCrumbLabels["saddlery"] = "Enfield - Saddlery";
breadCrumbLabels["learningsupport"] = "Learning Support";
breadCrumbLabels["crystalpalace"] = "Crystal Palace Centre";
breadCrumbLabels["openday"] = "Open Day";
breadCrumbLabels["gunnersburypark"] = "Gunnersbury Park Centre";
breadCrumbLabels["regentspark"] = "Regent's Park Centre";
breadCrumbLabels["shortcourses"] = "Enfield - Short Courses";
breadCrumbLabels["yourchoice"] = "It's your choice";
breadCrumbLabels["barkinganddagenhamcollege"] = "Barking & Dagenham College";
function displayBreadCrumbs(attempts)
{
	
	var theBreadCrumbBar = null;
	if (document.all)
	{
		theBreadCrumbBar = document.all.BreadCrumbBar;
	}
	else
	{
		theBreadCrumbBar = document.getElementById("BreadCrumbBar");
	}
	
	
	if (theBreadCrumbBar != null)
	{
		
		var thePath = location.href;
		var theProtocol = "";
		var theSite = "";
		
		
		theProtocol = thePath.substring(0, thePath.indexOf("://") + 3);
		thePath = thePath.substring(thePath.indexOf("://") + 3);
		
		
		theSite = thePath.substring(0, thePath.indexOf(sitePrefix));
		thePath = thePath.substring(thePath.indexOf(sitePrefix));
		
		
		thePath = thePath.substring(thePath.indexOf(sitePrefix) + sitePrefix.length);
		
		
		var theHash = "";
		if (thePath.indexOf("#") > -1)
		{
			theHash = thePath.substring(thePath.indexOf("#"));
			thePath = thePath.substring(0, thePath.indexOf("#"));
		}
		
		
		var crumbs = thePath.split("/");
		var currentPath = sitePrefix;
		var crumbCount = 0;
		
		
		var breadCrumb = document.createElement("span");
		breadCrumb.setAttribute("class", "breadCrumb");
		
		
		var crumbLabel = "Home";
		
		
		if ((breadCrumbLabels[sitePrefix] != null))
		{
			crumbLabel = breadCrumbLabels[sitePrefix];
		}
		
	
		if ((breadCrumbLabels[currentPath] != null))
		{
			crumbLabel = breadCrumbLabels[currentPath];
		}
		
		
		if ((0 < crumbs.length) &&
			(crumbs[0] != "index.html") &&
			(crumbs[0] != ""))
		{
			
			var linkTag = document.createElement("a");
			linkTag.href = theProtocol + theSite + currentPath;
			linkTag.appendChild(document.createTextNode(crumbLabel));
			breadCrumb.appendChild(linkTag);
		}
		else
		{
			
			breadCrumb.appendChild(document.createTextNode(crumbLabel));
		}
		theBreadCrumbBar.appendChild(breadCrumb);
		
		
		crumbCount++;
		
		
		for (var crumbIndex = 0; crumbIndex < crumbs.length; crumbIndex++)
		{
			
			currentPath += crumbs[crumbIndex];
			if (crumbIndex + 1 < crumbs.length)
			{
				currentPath += "/";
			}
			
			if ((crumbs[crumbIndex] != "") &&
				(crumbs[crumbIndex].indexOf("index.html") == -1))
			{
				
				var breadCrumb = document.createElement("span");
				breadCrumb.setAttribute("class", "breadCrumb");
				
				
				if (crumbCount > 0)
				{
					breadCrumb.appendChild(document.createTextNode(breadCrumbSeparator));
				}
				
				
				var crumbLabel = crumbs[crumbIndex].replace(/_/g, " ").replace(".html", "").replace(".asp", "").capitalize();
				
				
				if ((breadCrumbLabels[crumbs[crumbIndex]] != null))
				{
					crumbLabel = breadCrumbLabels[crumbs[crumbIndex]];
				}
				
				
				if ((breadCrumbLabels[currentPath] != null))
				{
					crumbLabel = breadCrumbLabels[currentPath];
				}
				
				
				if ((crumbIndex + 1 < crumbs.length) &&
					(crumbs[crumbIndex + 1] != "index.html") &&
					(crumbs[crumbIndex + 1] != ""))
				{
					
					var linkTag = document.createElement("a");
					linkTag.href = theProtocol + theSite + currentPath;
					linkTag.appendChild(document.createTextNode(crumbLabel));
					breadCrumb.appendChild(linkTag);
				}
				else
				{
					
					breadCrumb.appendChild(document.createTextNode(crumbLabel));
				}
				theBreadCrumbBar.appendChild(breadCrumb);
				
				
				crumbCount++;
			}
		}
	}
	else if (attempts < 5)
	{
		
		attempts++;
		setTimeout("displayBreadCrumbs(" + attempts + ");", 1000);
	}
}


String.prototype.capitalize = function()
{
	return this.replace(/\w+/g, function(a)
	{
		return a.charAt(0).toUpperCase() + a.substr(1).toLowerCase();
	});
};


displayBreadCrumbs(1);

