// JavaScript Document
/*
# ABOUT THIS SCRIPT
#
# js_paths.js takes the current document's location.href and splits it up into its
# various elements: protocol, folder hierarchy, and file name.
# It then offers choices if and how to display these elements.
#
# There's a built in naming convention that can be overridden at will for specific
# folders and/or files.
#
# Finally it puts everything back together and spits out the breadcrumb.
#
# HANDLING OF FOLDER HIERARCHY
#
# Since js_paths.js was created to work offline
# unwanted results are to be expected, like a breadcrumb that is so long that it fills half the page
# because of a gazillion folders in its path.
*/
function breadcrumbs() {

if (window.location){	
var path="";		// to hold the complete breadcrumb path
var href=window.location.href;
pref = new Array();	// for "partial href"
s=href.split("/");		// s: array that hold the folders' names
fname=new Array();	// fname: "full name" that will be displayed
parts=new Array();	// hold fname's parts[1]_parts[2]

for (i=2;i<(s.length-1);i++)
{pref[2]=s[2]+"\/";
pref[i+1]=pref[i]+s[i+1]+"/";};
i=s.length-2;
pref[i+1]=pref[i]+s[i+1];
for (i=2;i<(s.length-1);i++)
{fname[i]=s[i];

/* Here you can suppress display of folders' names
by assigning an empty fname string,
or change names to be displayed.*/

//This is where you may rename or suppress directories
if 	(s[i]==""){fname[i]=""}
if 	(s[i]==""){fname[i]=""}
if 	(s[i]==""){fname[i]=""}
if 	(s[i]==""){fname[i]=""}
if 	(s[i]==""){fname[i]=""}
if 	(s[i]==""){fname[i]=""}
if 	(s[i]==""){fname[i]=""}
if 	(s[i]==""){fname[i]=""}
if 	(s[i]==""){fname[i]=""}
if 	(s[i]==""){fname[i]=""}
if 	(s[i]==""){fname[i]=""}
if 	(s[i]==""){fname[i]=""}
if 	(s[i]==""){fname[i]=""}
if 	(s[i]==""){fname[i]=""}
if 	(s[i]==""){fname[i]=""}
if 	(s[i]==""){fname[i]=""}
if 	(s[i]==""){fname[i]=""}
if 	(s[i]==""){fname[i]=""}
if 	(s[i]==""){fname[i]=""}
if 	(s[i]==""){fname[i]=""}
if 	(s[i]==""){fname[i]=""}
if 	(s[i]==""){fname[i]=""}
if 	(s[i]==""){fname[i]=""}
if 	(s[i]==""){fname[i]=""}
if 	(s[i]=="pages"){fname[i]=""}
if 	(s[i]=="album"){fname[i]=""}
if 	(s[i]=="objects"){fname[i]=""}
if 	(s[i]=="coastal"){fname[i]=""}
if 	(s[i]=="wiston"){fname[i]=""}
if 	(s[i]=="upton"){fname[i]=""}
if 	(s[i]=="tenby"){fname[i]=""}
if 	(s[i]=="roch"){fname[i]=""}
if 	(s[i]=="newport"){fname[i]=""}
if 	(s[i]=="nevern"){fname[i]=""}
if 	(s[i]=="narberth"){fname[i]=""}
if 	(s[i]=="manorbier"){fname[i]=""}
if 	(s[i]=="llawhaden"){fname[i]=""}
if 	(s[i]=="haverfordwest"){fname[i]=""}
if 	(s[i]=="cilgerran"){fname[i]=""}
if 	(s[i]=="carew"){fname[i]=""}
if 	(s[i]=="benton"){fname[i]=""}
if 	(s[i]=="west_blockhouse_battery"){fname[i]=""}
if 	(s[i]=="thorne_island_fort"){fname[i]=""}
if 	(s[i]=="stack_rock_fort"){fname[i]=""}
if 	(s[i]=="st_catherines_fort"){fname[i]=""}
if 	(s[i]=="south_hook_fort"){fname[i]=""}
if 	(s[i]=="scoveston"){fname[i]=""}
if 	(s[i]=="quay_street_fort"){fname[i]=""}
if 	(s[i]=="p_dock_defensible"){fname[i]=""}
if 	(s[i]=="martello_guntower"){fname[i]=""}
if 	(s[i]=="hubberstone_fort"){fname[i]=""}
if 	(s[i]=="fort_popton"){fname[i]=""}
if 	(s[i]=="fishguard_fort"){fname[i]=""}
if 	(s[i]=="east_blockhouse_battery"){fname[i]=""}
if 	(s[i]=="dale_fort"){fname[i]=""}
if 	(s[i]=="chapel_bay_fort"){fname[i]=""}
if 	(s[i]=="angle_tower_house"){fname[i]=""}
if 	(s[i]=="wolfscastle_motte"){fname[i]=""}
if 	(s[i]=="st_davids_castle"){fname[i]=""}
if 	(s[i]=="sentence_castle"){fname[i]=""}
if 	(s[i]=="pointz_castle"){fname[i]=""}
if 	(s[i]=="picton_motte"){fname[i]=""}
if 	(s[i]=="others"){fname[i]=""}
if 	(s[i]=="new_moat"){fname[i]=""}
if 	(s[i]=="manorowen"){fname[i]=""}
if 	(s[i]=="llanfyrnach_castle"){fname[i]=""}
if 	(s[i]=="hayscastle"){fname[i]=""}
if 	(s[i]=="great_rudbaxton_mount"){fname[i]=""}
if 	(s[i]=="eglwyswrw_castle"){fname[i]=""}
if 	(s[i]=="castlemartin"){fname[i]=""}
if 	(s[i]=="castle_pill"){fname[i]=""}
if 	(s[i]=="castle_morris"){fname[i]=""}
if 	(s[i]=="castell_pen_yr_alt"){fname[i]=""}
if 	(s[i]=="castell_hendre"){fname[i]=""}
if 	(s[i]=="castell_cynon"){fname[i]=""}
if 	(s[i]=="castell_crychydd"){fname[i]=""}
if 	(s[i]=="camrose"){fname[i]=""}
if 	(s[i]=="amroth"){fname[i]=""}
if 	(s[i]=="castles"){fname[i]=""}
if 	(s[i]=="historical_events"){fname[i]=""}
if 	(s[i]=="haverfordwest"){fname[i]=""}
if 	(s[i]=="towns_a_to_e"){fname[i]=""}
if 	(s[i]=="towns_f_to_k"){fname[i]=""}
if 	(s[i]=="towns_l_to_p"){fname[i]=""}
if 	(s[i]=="towns_r_to_z"){fname[i]=""}
if 	(s[i]=="pembrokeshire_virtual_museum"){fname[i]="Home"}
if 	(s[i]=="main_menu"){fname[i]=""}
if 	(s[i]=="wwwroot"){fname[i]=""}
if 	(s[i]=="InetPub"){fname[i]=""}
if 	(s[i]=="webpages"){fname[i]=""}			
else if (s[i]=="localhost"){fname[i]=""}

else if (s[i]=="yourdomain.com"){fname[i]=""}				//This makes "yourdomain.com" invisible
else if (s[i]=="www.yourdomain.com"){fname[i]=""}

else if (s[i]=="C\:"){fname[i]=""}			//When developing your site locally, suppress local directories
else if (s[i]=="C|"){fname[i]=""}			//this is for Communicator 4.77win
else if (s[i]=="MY%20SITES"){fname[i]=""}
else if (s[i]=="MY SITES"){fname[i]=""}		//this is for Communicator 4.77win

else if (s[i]=="consulting"){fname[i]="[Consulting]"}
//If you have a folder/directory you want to show but not have 
else if (s[i]=="design"){fname[i]="web_design"}		//a link to it, put it in [square brackets]
									//Note: this will disable auto capitalization

/* Parse fname string and put it back togather as pnoun ('propper noun')
You can actually give a name to a folder here, consisting of more than one word.
To do so, separate the words with an underline "_". */

if (fname[i].charAt(0) !== "<")			// look at the first character. unless it's an '<'...e.g.<img>
	{
	pnoun = fname[i].charAt(0).toUpperCase();	// first character to upper case
	for (j=1;j<(fname[i].length);j++)
		{
		var k = j-1;					// k designates the character following the "_"
		if (fname[i].charAt(j) == "_")		// if there is an "_"...
			{
			pnoun+= " ";			// ...replace it with a space.
			}
		else if (fname[i].charAt(k) == "_")	// If  there is a "_" in front... 
			{
			pnoun+=fname[i].charAt(j).toUpperCase(); // ...capitalize the following character
			}
		else 
		{
			pnoun+=fname[i].charAt(j);	// Append each original character in fname onto pnoun
		}
		}
	fname[i]=pnoun;	// Replace fname with pnoun. (Optionally add ".toUpperCase()" if you want ALL upper case names.)
	}
};	//ops! Just a reminder to myself--was afraid this might get lost :-)

/* This writes the breadcrumb links.
Notice: I'm appending "index.htm" to the link here. Change this to your file type extension.*/

for (i=2;i<(s.length-2);i++)
{
(fname[i] == "")?(path+=""):((fname[i].charAt(0)=="[")?(path+=fname[i]+" \&raquo; "):(path+="<a href=\""+href.substring(0,href.indexOf(pref[i])+pref[i].length)+"index.html\">"+fname[i]+"</a> \&raquo; "));
}

i=s.length-2;
(fname[i] == "")?(path+=""):((fname[i].charAt(0)=="[")?(path+=fname[i]+" \&raquo; "):(path+="<a href=\""+href.substring(0,href.indexOf(pref[i])+pref[i].length)+"index.html\">"+fname[i]+"</a> \: "));

i=s.length-1;
fullname=s[i].substring(0,s[i].indexOf("."));

/* For any files not adhering to the naming scheme, you may specify a custom display name here: 
You can give a name to a page here, consisting of more than one word.
To do so, separate the words with an underline "_".*/

if (fullname==""){fullname="overview"}
if (fullname=="index"){fullname="overview"}
else if (fullname=="crptcnme"){fullname="some_name"}
else {};

pnoun = fullname.charAt(0).toUpperCase();		// first character to upper case
for (i=1;i<(fullname.length);i++)
{
var k = i-1;								// k designates the character following the "_"
if (fullname.charAt(i) == "_")					// if there is an "_"...
	{
	pnoun+= " ";						// ...replace it with a space.
	}
else if (fullname.charAt(k) == "_")				// If  there is a "_" in front...
	{
	pnoun+=fullname.charAt(i).toUpperCase();	// ...capitalize the following character
	}
else
	{
	pnoun+=fullname.charAt(i);				// Append each original character in fullname onto pnoun
	}
}
;path+=pnoun;
//url=window.location.protocol+"//"+path;	                    //use only to display protocol type (ftp://; http://)
url=path;								//If you do, comment out this line instead
document.write(url);
}
}
//done

