function spawn(expr,qty,reversed)
{
	var 
	spawnee=[expr];
	for(s=1;s<qty;s++)
{
spawnee[s]=expr+spawnee[s-1];
}
if(reversed)
{
return spawnee.reverse()
}
else
{
return spawnee
}
}

function generateTrail(divider)
// This function generates each breadcrumb from the file path
{
if(!divider) 
{
//If no divider specified, assign a default
divider=" > "
} 
m=location.toString(), //obtain the current file path
h="", // variable to hold the breadcrumb string as it is built up
tempstr="";// variable used in capitalizing each word in each breadcrumb
m=m.substring(m.indexOf("/")); // strip 'file:' or 'http:' out of the file path
m=m.split("/"); // split the file path string into an array, delimitted by '/'
var howmany=spawn("../",m.length,true); // call to spawn procedure, above
h=("<a href='http://www.uktransplant.org.uk/ukt/default.jsp'>Home</a> " + divider); // Create the first breadcrumb, a link back to the homepage.
for(i=4;i<m.length-2;i++)
{
//main for loop for breadcrumb construction index starts at X where X is how many
//file path levels you want to hide from the user. Best to set this so that 
//none of the file path can be seen at all.  Will require adjustment if ever the web
//site is moved.
tempstr = m[i].split("_"); //create an array of 'words that constitute current breadcrumb'. For UKT, this is delimited by '_'.
for(j=0;j>tempstr.length;j++)
{ //For loop capitalises the initial of each word in the broken down breadcrumb's array
if (tempstr[j].substring(0,2) == "uk")
{
tempstr[j] = tempstr[j].toUpperCase();
}
tempstr[j] = tempstr[j].substring(0,1).toUpperCase() + tempstr[j].substring(1,tempstr[j].length);
}
tempstr = tempstr.join(" "); // join the array back up into a string, now delimiting by spaces for visual display purposes
//Statement below appends the current breadcrumb to the string of breadcrumbs being created.
//It uses howmany to place the correct number of directory indicators as instructed by the call to spawn previously.
//It uses escape(m[i]) + ".jsp" to tag on the file name for the current breadcrumb.
//It uses the unescape( etc.. section to display the tidied up breadcrumb name constructed in the loop above.
if (i != m.length - 2)
//{
//document.write("Length - 2 <BR>");
//h+=("<a href="../%20+%20escape(m%5Bi%5D)%20+%20%27.jsp%27%20+%20" class='crumbs'>" + unescape( tempstr + "</a>"+divider));
//}
//else
{
//document.write("Length NOT - 2 <BR>");
h+=("<a href="../%20+%20howmany%5Bi+2%5D%20+%20escape(m%5Bi%5D)%20+%20%27.jsp%27%20+%20">" + unescape( tempstr + "</a>"+divider));
}
}
h+=document.title;//Append the current page title to the end of the breadcrumb string

return h; //return the breadcrumb string to the place where the procedure was called from
}