function breadcrumbs(titleText) 
{
var SEPARATOR 	= " | "	// This separates bread crumbs.
	var FILENAME 	= 0		// FILENAME, index, and directory identiry the path endings.
	var INDEX = 1
	var DIRECTORY 	= 2

	// Variables:
	var ending 		= null	// Tells us how the path ends - index.html, filename, or directory.
	var pageTitle 	= ""	// Used for the last bread crumb if the path ends in a filename.
	var depth 		= 0		// The depth of the path. For example: "../"
	var limit 		= 0		// How much of the path to put in the bread crumbs.

	// Get the current URL and convert it to lowercase.
	var urlString = window.location.href
	urlString = urlString.toLowerCase()
	
	// Remove "http://" - the first 7 characters - from the string.
	var crumbsArray = urlString.substr(7).split("/")

	if (urlString.indexOf('index.html') != -1)
	{
		ending = INDEX
		depth = crumbsArray.length - 2
		limit = crumbsArray.length - 3
	}
	// Does the url ends with a filename?
	else if (urlString.indexOf('.html') != -1)
	{
		ending = FILENAME
		depth = crumbsArray.length - 2
		limit = crumbsArray.length - 2
	}
	// Does the url end with a slash, dot, or empty string?
	else if ((crumbsArray[crumbsArray.length - 1].length == 0) || (crumbsArray[crumbsArray.length - 1] == ".")) 
	{
		ending = INDEX
		depth = crumbsArray.length - 2
		limit = crumbsArray.length - 3
	}
	// The url must end with a directory name.
	else
	{
		ending = DIRECTORY
		depth = crumbsArray.length - 1
		limit = crumbsArray.length - 1
	}

	// Write the first bread crumb - Home.
	document.write("<span class='breadcrumbs'><a href=\"" + getPath(depth--) + "\">Home</a>" + SEPARATOR);

	// Write the other bread crumbs until limit, which is the next-to-last bread crumb.
	for (var i = 1; i <= limit; i++) 
	{
		crumbsArray[i] = makeCaps(unescape(crumbsArray[i]));
		document.write("<a href=\"" + getPath(depth--) + "\">" + crumbsArray[i] + "</a>" + SEPARATOR);
	}

	// Write the last bread crumb - the one that identifies the current page - without a link.
	if (ending == INDEX)
	{
		if (titleText)
		{
			document.write(titleText)
		}
		else
		{
			document.write(makeCaps(crumbsArray[crumbsArray.length - 2]))
		}
	}	
	else if (ending == FILENAME)
	{
		if (titleText)
		{
			pageTitle = titleText
		}
		else
		{
			pageTitle = crumbsArray[crumbsArray.length - 1]
			pageTitle = pageTitle.substring(0, pageTitle.indexOf(".html"))
			pageTitle = makeCaps(unescape(pageTitle))
		}
		document.write(pageTitle)
	}
	else if (ending == DIRECTORY)
	{
			if (titleText)
			{
				document.write(titleText)
			}
			else
			{
				document.write(makeCaps(crumbsArray[crumbsArray.length - depth]))
			}
	}
	document.write("</span>")
}

function makeCaps(aString) 
{
	// If there are spaces in the string, split is using the space, otherwise split it using the underscore.
	var theString = (aString.indexOf(" ") != -1) ? aString.split(" ") : aString.split("_")

	for (var i = 0; i < theString.length; i++) 
	{
		theString[i] = theString[i].toUpperCase().slice(0, 1) + theString[i].slice(1);
	}
	return theString.join(" ")
}

// Create a string with "../" for every n level.
function getPath(aNumber)
{
	var path = "";
	if (aNumber > 0) 
	{
		for (var i = 0; i < aNumber; i++) 
		{
			path += "../"
		}
	}
	else
	{
		path = "."
	}
	return path
}
