function SplitURL(aURL, levelNames)
{
	// Remove the protocol
	x = aURL.indexOf("://");
	if (x == -1)
	{
		// Badly formed or not recognised protocol.
		return false;
	}
	point = x + 3;
	path = aURL.slice(point, aURL.length);
	levelCount = 0;
	while (-1)
	{
		levelCount++;
		nextlevel = path.indexOf("/");

		if (nextlevel == -1)
			nextlevel = path.indexOf("\\");

		PathSlice = path.slice(0, 1) + path.slice(1, nextlevel);

		if (levelCount == 1)
			levelNames[levelCount-1] = "Home";
		else
		{
			if (PathSlice == "list-xywzp.htm" || PathSlice == "list-xywzp.html")
				levelNames[levelCount-1] = "unlisted-url";
			else
				levelNames[levelCount-1] = PathSlice;
				
			if (PathSlice == "counselling-book" || PathSlice == "counselling-books" || PathSlice == "search-Book")
				break;
				
			if (nextlevel == -1)
				break;
		}
		path = path.slice(nextlevel+1, path.length);
	}
	return true;
}

function FormatPath(levelNames)
{
	// Format the division
	//document.write("<DIV style='border: solid black; border-width:thin;margin:0;background:#99CCFF; padding: 0 em'>");

	document.write("<table border=0 cellspacing=0 cellpadding=0 width=98% align=center><tr ><td colspan=4 height=1 bgcolor=0><img src=/images/black-line.gif height=1 width=1></td></tr><tr bgcolor='#B0D987'><td width=1 bgcolor=0><img src=/images/black-line.gif height=1 width=1></td><td>");

	// Write the "You are here" bits...
	document.write("<SPAN class='you-are-here'>&nbsp;<b>You're here: </b>");
	for (x = 0; x < levelNames.length; x++)
	{
		if (x == 0)
			aAnchor = "/";
		else
			aAnchor = aAnchor + levelNames[x] + "/";

			
		if (x < levelNames.length-1)
		{
			document.write("<a href='"+aAnchor);
			//if (x == 0)
			//	document.write("index.html");
			document.write("'>" + levelNames[x] + "</a>");
	
			document.write(" > ");
		} else
			document.write(levelNames[x]);
	}

	//document.write("</div>");
	document.write("</SPAN></td>");

        document.write("<td align=right valign=top><a href=/php/Top-Ten-Counselling-Books.php>Top Ten Books</a>&nbsp;|&nbsp;<a href=/counselling-books/Whatsnew/A/0/>New&nbsp;Books!</a> </td>");
	document.write("<td width=1 bgcolor=0><img src=/images/black-line.gif height=1 width=1></td></tr><tr ><td colspan=4 height=1 bgcolor=0><img src=/images/black-line.gif height=1 width=1><img src=/images/black-line.gif height=1 width=1></td></tr><tr><td colspan=4 height=5></td></tr></table>");

	//document.write("<br>");
}

levelNames = new Array(0);
if (SplitURL(document.URL, levelNames))
	FormatPath(levelNames);
